diff --git a/src/geouned/GEOUNED/Utils/BasicFunctions_part2.py b/src/geouned/GEOUNED/Utils/BasicFunctions_part2.py index 85d9cc9c..9b3b9679 100644 --- a/src/geouned/GEOUNED/Utils/BasicFunctions_part2.py +++ b/src/geouned/GEOUNED/Utils/BasicFunctions_part2.py @@ -63,7 +63,7 @@ def is_same_plane(p1, p2, options, tolerances, numeric_format, fuzzy=(False, 0)) d2 = -d2 d = abs(d1 - d2) if tolerances.relativeTol: - tol = tolerances.pln_distance * max(p2.dim1, p2.dim2) + tol = tolerances.pln_distance * max(p2.dimL1, p2.dimL2) else: tol = tolerances.pln_distance @@ -120,7 +120,15 @@ def is_same_cylinder( is_same_center, is_fuzzy = is_in_tolerance(d, tol, 0.5 * tol, 2 * tol) if is_fuzzy and fuzzy[0]: Fuzzy( - fuzzy[1], "cylAxs", cyl1, cyl2, d, tol, tolerances, numeric_format + fuzzy[1], + "cylAxs", + cyl1, + cyl2, + d, + tol, + options, + tolerances, + numeric_format, ) return is_same_center diff --git a/tests/test_convert.py b/tests/test_convert.py index a1e0d9e0..b78352e5 100644 --- a/tests/test_convert.py +++ b/tests/test_convert.py @@ -180,3 +180,20 @@ def test_cad_to_csg_from_json_with_non_defaults(): my_cad_to_csg.start() my_cad_to_csg.export_csg() + + +def test_with_relative_tol_true(): + + # test to protect against incorrect attribute usage in FreeCAD + # more details https://github.com/GEOUNED-org/GEOUNED/issues/154 + + geo = geouned.CadToCsg( + stepFile=f"{step_files[1].resolve()}", + tolerances=geouned.Tolerances(relativeTol=False), + ) + geo.start() + geo = geouned.CadToCsg( + stepFile=f"{step_files[1].resolve()}", + tolerances=geouned.Tolerances(relativeTol=True), + ) + geo.start()