From 0b8fb41ac45a732dea04e11a99199c7082b289f3 Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Tue, 29 Apr 2025 17:32:27 +0500 Subject: [PATCH] bim.add_array - guard from unexpected element types So we can gradually expand it with the things we do know to support. --- src/bonsai/bonsai/bim/module/model/array.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/bonsai/bonsai/bim/module/model/array.py b/src/bonsai/bonsai/bim/module/model/array.py index fd023b94da..5eab0c48ca 100644 --- a/src/bonsai/bonsai/bim/module/model/array.py +++ b/src/bonsai/bonsai/bim/module/model/array.py @@ -38,6 +38,13 @@ class AddArray(bpy.types.Operator, tool.Ifc.Operator): assert (element := tool.Ifc.get_entity(obj)) ifc_file = tool.Ifc.get() + if not element.is_a("IfcElement") and not element.is_a("IfcAnnotation"): + self.report( + {"ERROR"}, + f"Adding array to element of type '{element.is_a()}' is not supported. Supported types: IfcElement, IfcAnnotation.", + ) + return {"CANCELLED"} + array = { "children": [], "count": 1,