diff --git a/src/bonsai/bonsai/bim/module/boundary/operator.py b/src/bonsai/bonsai/bim/module/boundary/operator.py index d29c50cf69..072e28fd4c 100644 --- a/src/bonsai/bonsai/bim/module/boundary/operator.py +++ b/src/bonsai/bonsai/bim/module/boundary/operator.py @@ -42,16 +42,6 @@ import bonsai.core import bonsai.core.geometry -def get_boundaries_collection(blender_space): - space_collection = blender_space.BIMObjectProperties.collection - collection_name = f"Boundaries/{blender_space.BIMObjectProperties.ifc_definition_id}" - boundaries_collection = space_collection.children.get(collection_name) - if not boundaries_collection: - boundaries_collection = bpy.data.collections.new(collection_name) - space_collection.children.link(boundaries_collection) - return boundaries_collection - - def disable_editing_boundary_geometry(context): ProfileDecorator.uninstall() bpy.ops.object.mode_set(mode="OBJECT") @@ -164,9 +154,8 @@ class Loader: mesh = self.create_mesh(boundary) obj = bpy.data.objects.new(f"{boundary.is_a()}/{boundary.Name}", mesh) obj.matrix_world = blender_space.matrix_world - boundaries_collection = get_boundaries_collection(blender_space) - boundaries_collection.objects.link(obj) tool.Ifc.link(boundary, obj) + tool.Collector.assign(obj) return obj @@ -821,7 +810,6 @@ class AddBoundary(bpy.types.Operator, tool.Ifc.Operator): # Create shape of opening as a dissolved BMesh settings = ifcopenshell.geom.settings() shape = ifcopenshell.geom.create_shape(settings, opening) - m = shape.transformation.matrix mat = Matrix(ifcopenshell.util.shape.get_shape_matrix(shape)) mat.translation = (0, 0, 0) opening_bm = bmesh.new() @@ -942,8 +930,6 @@ class AddBoundary(bpy.types.Operator, tool.Ifc.Operator): # space. exterior_boundary_polygon = shapely.Polygon(gross_boundary_polygon.exterior.coords) - inner_boundaries = [] - for rel in getattr(related_building_element, "HasOpenings", []): opening = rel.RelatedOpeningElement if not opening.HasFillings: diff --git a/src/bonsai/bonsai/tool/collector.py b/src/bonsai/bonsai/tool/collector.py index 51e78fd108..b815bfab92 100644 --- a/src/bonsai/bonsai/tool/collector.py +++ b/src/bonsai/bonsai/tool/collector.py @@ -71,6 +71,9 @@ class Collector(bonsai.core.tool.Collector): elif element.is_a("IfcStructuralItem"): collection = cls._create_project_child_collection("IfcStructuralItem") cls.link_collection_object_safe(collection, obj) + elif element.is_a("IfcRelSpaceBoundary"): + collection = cls._create_project_child_collection("IfcRelSpaceBoundary") + cls.link_collection_object_safe(collection, obj) elif element.is_a("IfcLinearPositioningElement"): if tool.Geometry.is_locked(element): tool.Geometry.lock_object(obj)