mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-20 06:58:56 +00:00
Fix #7397 - don't delete aggregate if relatingobject is a IfcSpatialElement
This commit is contained in:
@@ -127,6 +127,10 @@ class BIM_OT_aggregate_unassign_object(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
# Second pass: delete aggregates that now have no parts
|
# Second pass: delete aggregates that now have no parts
|
||||||
deleted_aggregates = []
|
deleted_aggregates = []
|
||||||
for aggregate in aggregates_to_check:
|
for aggregate in aggregates_to_check:
|
||||||
|
# Skip spatial elements - they should not be deleted even if empty
|
||||||
|
if aggregate.is_a("IfcSpatialElement"):
|
||||||
|
continue
|
||||||
|
|
||||||
related_objects = ifcopenshell.util.element.get_parts(aggregate)
|
related_objects = ifcopenshell.util.element.get_parts(aggregate)
|
||||||
if len(related_objects) == 0:
|
if len(related_objects) == 0:
|
||||||
aggregate_name = aggregate.Name or f"{aggregate.is_a()} #{aggregate.id()}"
|
aggregate_name = aggregate.Name or f"{aggregate.is_a()} #{aggregate.id()}"
|
||||||
|
|||||||
@@ -975,6 +975,10 @@ class OverrideDelete(bpy.types.Operator):
|
|||||||
except:
|
except:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
# Skip spatial elements - they should not be deleted even if empty
|
||||||
|
if aggregate.is_a("IfcSpatialElement"):
|
||||||
|
continue
|
||||||
|
|
||||||
related_objects = ifcopenshell.util.element.get_parts(aggregate)
|
related_objects = ifcopenshell.util.element.get_parts(aggregate)
|
||||||
if len(related_objects) == 0:
|
if len(related_objects) == 0:
|
||||||
aggregate_name = aggregate.Name or f"{aggregate.is_a()} #{aggregate.id()}"
|
aggregate_name = aggregate.Name or f"{aggregate.is_a()} #{aggregate.id()}"
|
||||||
|
|||||||
Reference in New Issue
Block a user