From 6b0b7989b01eec8444e596f11f4d1a4a3e7783ac Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Mon, 23 Dec 2024 15:47:36 +0500 Subject: [PATCH] Fix error appending elements without type #5902 --- src/bonsai/bonsai/bim/module/project/operator.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/bonsai/bonsai/bim/module/project/operator.py b/src/bonsai/bonsai/bim/module/project/operator.py index 2af804dbc6..41410d84fb 100644 --- a/src/bonsai/bonsai/bim/module/project/operator.py +++ b/src/bonsai/bonsai/bim/module/project/operator.py @@ -465,11 +465,11 @@ class AppendLibraryElement(bpy.types.Operator, tool.Ifc.Operator): if element.is_a("IfcTypeProduct"): self.import_type_from_ifc(element, context) elif element.is_a("IfcProduct"): - # NOTE: not used as UI doesn't allow appending non-types + # NOTE: Non-types are not exposed in UI directly + # but the code is still used when appending products by query. self.import_product_from_ifc(element, context) element_type = ifcopenshell.util.element.get_type(element) - obj = tool.Ifc.get_object(element_type) - if obj is None: + if element_type is not None and tool.Ifc.get_object(element_type) is None: self.import_type_from_ifc(element_type, context) elif element.is_a("IfcMaterial"): self.import_material_from_ifc(element, context)