From 48026c7a50f7a890d04912984eb59ba302fc967e Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Sat, 20 Jul 2024 15:49:05 +1000 Subject: [PATCH] Fix bug where adding a duct failed due to no container obj being calculated --- src/blenderbim/blenderbim/bim/module/model/product.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/blenderbim/blenderbim/bim/module/model/product.py b/src/blenderbim/blenderbim/bim/module/model/product.py index 6599825048..c3664a17b2 100644 --- a/src/blenderbim/blenderbim/bim/module/model/product.py +++ b/src/blenderbim/blenderbim/bim/module/model/product.py @@ -144,6 +144,10 @@ class AddConstrTypeInstance(bpy.types.Operator): if self.from_invoke and str(self.relating_type_id) in AuthoringData.data["relating_type_id"]: props.relating_type_id = str(self.relating_type_id) + self.container_obj = None + if container := tool.Root.get_default_container(): + self.container_obj = tool.Ifc.get_object(container) + relating_type = tool.Ifc.get().by_id(int(relating_type_id)) ifc_class = relating_type.is_a() instance_class = ifcopenshell.util.type.get_applicable_entities(ifc_class, tool.Ifc.get().schema)[0] @@ -192,10 +196,6 @@ class AddConstrTypeInstance(bpy.types.Operator): obj.location = context.scene.cursor.location - self.container_obj = None - if container := tool.Root.get_default_container(): - self.container_obj = tool.Ifc.get_object(container) - bpy.ops.bim.assign_class(obj=obj.name, ifc_class=instance_class) tool.Blender.remove_data_block(mesh) # Remove "Instance" mesh