mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-20 23:36:20 +00:00
Openings are now placed in their own collection in case they accidentally get placed in the spatial tree
This commit is contained in:
@@ -129,6 +129,8 @@ class AssignClass(bpy.types.Operator):
|
||||
|
||||
if product.is_a("IfcElementType"):
|
||||
self.place_in_types_collection(obj)
|
||||
elif product.is_a("IfcOpeningElement"):
|
||||
self.place_in_openings_collection(obj)
|
||||
elif (
|
||||
product.is_a("IfcSpatialElement")
|
||||
or product.is_a("IfcSpatialStructureElement")
|
||||
@@ -152,6 +154,18 @@ class AssignClass(bpy.types.Operator):
|
||||
break
|
||||
break
|
||||
|
||||
def place_in_openings_collection(self, obj):
|
||||
for project in [c for c in bpy.context.view_layer.layer_collection.children if "IfcProject" in c.name]:
|
||||
if not [c for c in project.children if "IfcOpeningElements" in c.name]:
|
||||
opening_elements = bpy.data.collections.new("IfcOpeningElements")
|
||||
project.collection.children.link(opening_elements)
|
||||
for collection in [c for c in project.children if "IfcOpeningElements" in c.name]:
|
||||
for user_collection in obj.users_collection:
|
||||
user_collection.objects.unlink(obj)
|
||||
collection.collection.objects.link(obj)
|
||||
break
|
||||
break
|
||||
|
||||
def place_in_spatial_collection(self, obj):
|
||||
for collection in obj.users_collection:
|
||||
if collection.name == obj.name:
|
||||
|
||||
Reference in New Issue
Block a user