diff --git a/src/blenderbim/blenderbim/bim/module/geometry/operator.py b/src/blenderbim/blenderbim/bim/module/geometry/operator.py index 64309df049..f2660e358a 100644 --- a/src/blenderbim/blenderbim/bim/module/geometry/operator.py +++ b/src/blenderbim/blenderbim/bim/module/geometry/operator.py @@ -816,10 +816,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) @@ -1003,10 +1003,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() @@ -1082,7 +1082,6 @@ class RefreshLinkedAggregate(bpy.types.Operator): if r.is_a("IfcRelAssignsToGroup") if self.group_name in r.RelatingGroup.Name ] -<<<<<<< HEAD selection_group.append(product_linked_agg_group[0].id()) if len(set(selection_group))> 1: diff --git a/src/blenderbim/blenderbim/tool/root.py b/src/blenderbim/blenderbim/tool/root.py index 364c01a276..fe2fa6289f 100644 --- a/src/blenderbim/blenderbim/tool/root.py +++ b/src/blenderbim/blenderbim/tool/root.py @@ -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,