From 3a824ec969b4d3a7b4976a99a1371720f8653c42 Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Thu, 15 May 2025 19:17:51 +0500 Subject: [PATCH] Allow adding arrays to openings and spatial elements 0b8fb41 0e37528 --- src/bonsai/bonsai/bim/module/model/array.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/bonsai/bonsai/bim/module/model/array.py b/src/bonsai/bonsai/bim/module/model/array.py index 5eab0c48ca..5bfbfbda59 100644 --- a/src/bonsai/bonsai/bim/module/model/array.py +++ b/src/bonsai/bonsai/bim/module/model/array.py @@ -38,10 +38,17 @@ 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"): + allowed_types = ( + "IfcElement", + "IfcAnnotation", + "IfcOpeningElement", + "IfcSpatialElement", + ) + + if not any(element.is_a(c) for c in allowed_types): self.report( {"ERROR"}, - f"Adding array to element of type '{element.is_a()}' is not supported. Supported types: IfcElement, IfcAnnotation.", + f"Adding array to element of type '{element.is_a()}' is not supported. Supported types: {','.join(allowed_types)}.", ) return {"CANCELLED"}