From 4c3bb54f98fbe7f6dc82eab3f58eb293636686c6 Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Mon, 28 Oct 2024 17:58:04 +0500 Subject: [PATCH] bim.update_representation to detect openings from it's aggregate and show an error Previously it would apply scale and geometry with opening to the representation, basically corrupting it. --- src/bonsai/bonsai/bim/module/geometry/operator.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/bonsai/bonsai/bim/module/geometry/operator.py b/src/bonsai/bonsai/bim/module/geometry/operator.py index 2b76f48252..8f3031767b 100644 --- a/src/bonsai/bonsai/bim/module/geometry/operator.py +++ b/src/bonsai/bonsai/bim/module/geometry/operator.py @@ -423,7 +423,10 @@ class UpdateRepresentation(bpy.types.Operator, tool.Ifc.Operator): product = self.file.by_id(obj.BIMObjectProperties.ifc_definition_id) material = ifcopenshell.util.element.get_material(product, should_skip_usage=True) - if getattr(product, "HasOpenings", False) and obj.data.BIMMeshProperties.has_openings_applied: + # NOTE: Currently iterator doesn't detect whether opening is actually affected the representation + # or it's just present on the element. In theory, we can also allow editing representations + # if we know that representation wasn't affected by existing openings. + if tool.Geometry.has_openings(product) and obj.data.BIMMeshProperties.has_openings_applied: # Meshlike things with openings can only be updated without openings applied. if self.from_ui: self.report({"ERROR"}, f"Object '{obj.name}' has openings - representation cannot be updated.")