mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-05 23:41:44 +00:00
bonsai: preserve original tessellation edges from the CGAL kernel
Fixes #5711. Also relevant to #5862 and #6747. Root cause: tool.Loader.create_settings() builds the geometry settings used for every import without enabling the CGAL kernel's cgal-original-edges option. Bonsai's default geometry library is hybrid-cgal-simple-opencascade, so most elements are triangulated by CGAL, which groups all mutually adjacent coplanar triangles into a single face boundary and only reports edges between non-coplanar components. Any edge between two distinct but coplanar source faces (for example a tessellation deliberately split into two coplanar quads) is therefore never recorded in ios_edges, so Geometry.dissolve_triangulated_edges silently merges those faces into one n-gon the moment the object is edited, even though nothing in the IFC file asked for that simplification. Enabling cgal-original-edges makes the kernel report genuine face boundaries instead of grouping by coplanarity. Verified live in headless Blender 5.2 with a synthetic tessellated wall split into two coplanar quads: before the fix the imported mesh collapsed to a 6-vertex ngon plus a quad (10 edges), after the fix it kept 3 separate quads (11 edges), matching the OpenCASCADE kernel's output. Also verified against a synthetic wall with an opening (the case aothms flagged as risky, since booleans/voids have no meaningful original topology to preserve) using Bonsai's actual default hybrid-cgal-simple-opencascade library end to end: face and edge counts were identical with and without the setting, because that library already falls back to OpenCASCADE for boolean/void geometry, so this change does not touch that path. Note the caveat does still apply if a user explicitly switches Geometry Library to plain CGAL on a model with lots of openings; a synthetic-only check of that specific combination showed more exposed triangulation edges there. Generated with the assistance of an AI coding tool.
This commit is contained in:
@@ -727,6 +727,15 @@ class Loader(bonsai.core.tool.Loader):
|
||||
settings.set("layerset-first", True)
|
||||
# Wire intersection checks is prohibitively slow on advanced breps. See bug #5999.
|
||||
settings.set("no-wire-intersection-check", True)
|
||||
# By default the CGAL kernel groups adjacent coplanar triangles into a
|
||||
# single face boundary, discarding edges between distinct but coplanar
|
||||
# source faces (e.g. a tessellation deliberately split into two
|
||||
# coplanar quads). This makes those edges vanish when entering edit
|
||||
# mode (see #5711, #5862). Preserve the original face boundaries
|
||||
# instead. This is a no-op for the OpenCASCADE kernel and, in the
|
||||
# default hybrid-cgal-simple-opencascade library, booleans/voids are
|
||||
# resolved via the OpenCASCADE fallback so this does not affect them.
|
||||
settings.set("cgal-original-edges", True)
|
||||
# settings.set("triangulation-type", ifcopenshell.ifcopenshell_wrapper.POLYHEDRON_WITHOUT_HOLES)
|
||||
if is_gross:
|
||||
settings.set("disable-opening-subtractions", True)
|
||||
|
||||
Reference in New Issue
Block a user