Fix #5515. Spaces are now special and have their own collection. Elements in a space don't go inside a space collection anymore.

There can be hundreds of spaces in a building, and generally we use collections for bulk selections (i.e. at the floor level) not for spaces.
This commit is contained in:
Dion Moult
2024-10-08 22:35:15 +11:00
parent fdf4749dd7
commit 3c51c6325c
+5
View File
@@ -63,6 +63,9 @@ class Collector(bonsai.core.tool.Collector):
elif element.is_a("IfcOpeningElement"):
collection = cls._create_project_child_collection("IfcOpeningElement")
cls.link_collection_object_safe(collection, obj)
elif element.is_a("IfcSpace"):
collection = cls._create_project_child_collection("IfcSpace")
cls.link_collection_object_safe(collection, obj)
elif element.is_a("IfcStructuralItem"):
collection = cls._create_project_child_collection("IfcStructuralItem")
cls.link_collection_object_safe(collection, obj)
@@ -102,6 +105,8 @@ class Collector(bonsai.core.tool.Collector):
elif element.is_a("IfcAnnotation") and (drawing_obj := cls.get_annotation_drawing_obj(element)):
cls.link_collection_object_safe(drawing_obj.BIMObjectProperties.collection, obj)
elif container := ifcopenshell.util.element.get_container(element):
while container.is_a("IfcSpace"):
container = ifcopenshell.util.element.get_aggregate(container)
container_obj = tool.Ifc.get_object(container)
if not (collection := container_obj.BIMObjectProperties.collection):
cls.assign(container_obj)