bugfix in recreate_aggregate

This commit is contained in:
Bruno Perdigão
2023-11-20 22:05:41 -03:00
parent b45001a95a
commit 8e64b55290
2 changed files with 19 additions and 7 deletions
@@ -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:
+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,