mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-19 14:41:25 +00:00
Fix #6034. Boundary module now uses the collector tool like everything else.
This commit is contained in:
@@ -42,16 +42,6 @@ import bonsai.core
|
|||||||
import bonsai.core.geometry
|
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):
|
def disable_editing_boundary_geometry(context):
|
||||||
ProfileDecorator.uninstall()
|
ProfileDecorator.uninstall()
|
||||||
bpy.ops.object.mode_set(mode="OBJECT")
|
bpy.ops.object.mode_set(mode="OBJECT")
|
||||||
@@ -164,9 +154,8 @@ class Loader:
|
|||||||
mesh = self.create_mesh(boundary)
|
mesh = self.create_mesh(boundary)
|
||||||
obj = bpy.data.objects.new(f"{boundary.is_a()}/{boundary.Name}", mesh)
|
obj = bpy.data.objects.new(f"{boundary.is_a()}/{boundary.Name}", mesh)
|
||||||
obj.matrix_world = blender_space.matrix_world
|
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.Ifc.link(boundary, obj)
|
||||||
|
tool.Collector.assign(obj)
|
||||||
return obj
|
return obj
|
||||||
|
|
||||||
|
|
||||||
@@ -821,7 +810,6 @@ class AddBoundary(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
# Create shape of opening as a dissolved BMesh
|
# Create shape of opening as a dissolved BMesh
|
||||||
settings = ifcopenshell.geom.settings()
|
settings = ifcopenshell.geom.settings()
|
||||||
shape = ifcopenshell.geom.create_shape(settings, opening)
|
shape = ifcopenshell.geom.create_shape(settings, opening)
|
||||||
m = shape.transformation.matrix
|
|
||||||
mat = Matrix(ifcopenshell.util.shape.get_shape_matrix(shape))
|
mat = Matrix(ifcopenshell.util.shape.get_shape_matrix(shape))
|
||||||
mat.translation = (0, 0, 0)
|
mat.translation = (0, 0, 0)
|
||||||
opening_bm = bmesh.new()
|
opening_bm = bmesh.new()
|
||||||
@@ -942,8 +930,6 @@ class AddBoundary(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
# space.
|
# space.
|
||||||
exterior_boundary_polygon = shapely.Polygon(gross_boundary_polygon.exterior.coords)
|
exterior_boundary_polygon = shapely.Polygon(gross_boundary_polygon.exterior.coords)
|
||||||
|
|
||||||
inner_boundaries = []
|
|
||||||
|
|
||||||
for rel in getattr(related_building_element, "HasOpenings", []):
|
for rel in getattr(related_building_element, "HasOpenings", []):
|
||||||
opening = rel.RelatedOpeningElement
|
opening = rel.RelatedOpeningElement
|
||||||
if not opening.HasFillings:
|
if not opening.HasFillings:
|
||||||
|
|||||||
@@ -71,6 +71,9 @@ class Collector(bonsai.core.tool.Collector):
|
|||||||
elif element.is_a("IfcStructuralItem"):
|
elif element.is_a("IfcStructuralItem"):
|
||||||
collection = cls._create_project_child_collection("IfcStructuralItem")
|
collection = cls._create_project_child_collection("IfcStructuralItem")
|
||||||
cls.link_collection_object_safe(collection, obj)
|
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"):
|
elif element.is_a("IfcLinearPositioningElement"):
|
||||||
if tool.Geometry.is_locked(element):
|
if tool.Geometry.is_locked(element):
|
||||||
tool.Geometry.lock_object(obj)
|
tool.Geometry.lock_object(obj)
|
||||||
|
|||||||
Reference in New Issue
Block a user