Fix #6034. Boundary module now uses the collector tool like everything else.

This commit is contained in:
Dion Moult
2025-01-24 09:57:33 +11:00
parent 1083651d0a
commit 2ec7882c57
2 changed files with 4 additions and 15 deletions
@@ -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:
+3
View File
@@ -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)