Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fixing issue 154 #158

Merged
merged 4 commits into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/geouned/GEOUNED/Utils/BasicFunctions_part2.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
17 changes: 17 additions & 0 deletions tests/test_convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()