From 2e143f65d99a0d60b3ea080bfc8de17f17557ada Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Tue, 30 May 2023 16:07:10 +1000 Subject: [PATCH] Fix #3211. Generated fills now are siblings to the element that they void. --- .../blenderbim/bim/module/model/product.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/blenderbim/blenderbim/bim/module/model/product.py b/src/blenderbim/blenderbim/bim/module/model/product.py index 5f3f9703fb..fc1e5e2026 100644 --- a/src/blenderbim/blenderbim/bim/module/model/product.py +++ b/src/blenderbim/blenderbim/bim/module/model/product.py @@ -127,7 +127,19 @@ class AddConstrTypeInstance(bpy.types.Operator): obj = bpy.data.objects.new(tool.Model.generate_occurrence_name(relating_type, instance_class), mesh) obj.location = context.scene.cursor.location - collection = context.view_layer.active_layer_collection.collection + + collection = None + if ( + building_obj + and building_element + and building_element.is_a() in ["IfcWall", "IfcWallStandardCase", "IfcCovering"] + and instance_class in ["IfcWindow", "IfcDoor"] + ): + # Fills should be a sibling to the building element + collection = building_obj.users_collection[0] + if not collection: + collection = context.view_layer.active_layer_collection.collection + collection.objects.link(obj) collection_obj = bpy.data.objects.get(collection.name)