From 96ba8e8e297dbda409e07c9bee2429c027eb35e8 Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Wed, 18 Sep 2024 17:34:41 +1000 Subject: [PATCH] Fix bug where dissolving edges created corrupted geometry for advanced breps with curved surfaces --- src/bonsai/bonsai/tool/geometry.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/bonsai/bonsai/tool/geometry.py b/src/bonsai/bonsai/tool/geometry.py index 8f38a6e044..63aed1dd8b 100644 --- a/src/bonsai/bonsai/tool/geometry.py +++ b/src/bonsai/bonsai/tool/geometry.py @@ -190,6 +190,15 @@ class Geometry(bonsai.core.tool.Geometry): @classmethod def dissolve_triangulated_edges(cls, obj: bpy.types.Object) -> None: + # AdvancedBreps may contain non-faceted, curved faces (e.g. as part of + # a cylinder) so dissolving edges should not be allowed. + mesh_element = tool.Ifc.get().by_id(obj.data.BIMMeshProperties.ifc_definition_id) + if ( + mesh_element.is_a("IfcShapeRepresentation") + and ifcopenshell.util.representation.resolve_representation(mesh_element).RepresentationType + == "AdvancedBrep" + ) or mesh_element.is_a("IfcAdvancedBrep"): + return if obj.data and "ios_edges" in obj.data: bm = bmesh.new() bm.from_mesh(obj.data)