bugfix in recreate_aggregate

This commit is contained in:
Bruno Perdigão
2023-11-20 22:05:41 -03:00
parent b2cb907599
commit f859c06858
2 changed files with 19 additions and 6 deletions
@@ -820,10 +820,10 @@ class OverrideDuplicateMove(bpy.types.Operator):
if new.is_a("IfcRelSpaceBoundary"):
tool.Boundary.decorate_boundary(new_obj)
# Recreate assembly relationship
# Recreate aggregate relationship
for old in old_to_new.keys():
if old.is_a("IfcElementAssembly"):
tool.Root.recreate_assembly(old_to_new)
tool.Root.recreate_aggregate(old_to_new)
# Remove connections with old objects and recreates paths
OverrideDuplicateMove.remove_old_connections(old_to_new)
@@ -1007,10 +1007,10 @@ class DuplicateMoveLinkedAggregate(bpy.types.Operator):
old_to_new = OverrideDuplicateMove.execute_ifc_duplicate_operator(self, context, linked=True)
# Recreate assembly relationship
# Recreate aggregate relationship
for old in old_to_new.keys():
if old.is_a("IfcElementAssembly"):
tool.Root.recreate_assembly(old_to_new)
tool.Root.recreate_aggregate(old_to_new)
blenderbim.bim.handler.refresh_ui_data()
+15 -2
View File
@@ -233,11 +233,24 @@ class Root(blenderbim.core.tool.Root):
@classmethod
def recreate_assembly(cls, old_to_new):
def recreate_aggregate(cls, old_to_new):
print("O_T_N", old_to_new)
for old, new in old_to_new.items():
old_aggregate = ifcopenshell.util.element.get_aggregate(old)
print("Old", old_aggregate)
if old_aggregate:
new_aggregate = old_to_new[old_aggregate]
try:
new_aggregate = old_to_new[old_aggregate]
except:
blenderbim.core.aggregate.unassign_object(
tool.Ifc,
tool.Aggregate,
tool.Collector,
relating_obj=tool.Ifc.get_object(old_aggregate),
related_obj=tool.Ifc.get_object(new[0]),
)
continue
blenderbim.core.aggregate.assign_object(
tool.Ifc,
tool.Aggregate,