From dbfe3ea3c4a975dc58f83aa3341e4f6ddde89b5e Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Mon, 21 Oct 2024 18:05:22 +0500 Subject: [PATCH] bim.update_representation - error message for objects with openings --- src/bonsai/bonsai/bim/module/geometry/operator.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/bonsai/bonsai/bim/module/geometry/operator.py b/src/bonsai/bonsai/bim/module/geometry/operator.py index 45135e7d3f..48fc41cdc4 100644 --- a/src/bonsai/bonsai/bim/module/geometry/operator.py +++ b/src/bonsai/bonsai/bim/module/geometry/operator.py @@ -392,6 +392,12 @@ class UpdateRepresentation(bpy.types.Operator, tool.Ifc.Operator): obj: bpy.props.StringProperty() ifc_representation_class: bpy.props.StringProperty() + from_ui = False + + def invoke(self, context, event): + self.from_ui = True + return self.execute(context) + def _execute(self, context): if context.view_layer.objects.active and context.view_layer.objects.active.mode != "OBJECT": # Ensure mode is object to prevent invalid mesh data causing CTD @@ -419,6 +425,8 @@ class UpdateRepresentation(bpy.types.Operator, tool.Ifc.Operator): if getattr(product, "HasOpenings", False) 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.") return if not product.is_a("IfcGridAxis"):