ifc_duplicate_operator now remove the connections with old objects. Similar solutions presented in PR #3789

This commit is contained in:
Bruno Perdigão
2023-10-16 15:39:38 -03:00
parent f5f9862b78
commit 0028fd3e9c
@@ -811,6 +811,9 @@ class OverrideDuplicateMove(bpy.types.Operator):
if old.is_a("IfcElementAssembly"):
OverrideDuplicateMove.recreate_assembly(old_to_new)
# Remove connections with old objects
OverrideDuplicateMove.remove_old_connections(old_to_new)
# Recreate decompositions
tool.Root.recreate_decompositions(relationships, old_to_new)
blenderbim.bim.handler.refresh_ui_data()
@@ -867,6 +870,17 @@ class OverrideDuplicateMove(bpy.types.Operator):
related_obj=tool.Ifc.get_object(new_element[0]),
)
def remove_old_connections(old_to_new):
for new in old_to_new.values():
for connection in new[0].ConnectedTo:
entity = connection.RelatedElement
if entity in old_to_new.keys():
core.remove_connection(tool.Geometry, connection=connection)
for connection in new[0].ConnectedFrom:
entity = connection.RelatingElement
if entity in old_to_new.keys():
core.remove_connection(tool.Geometry, connection=connection)
class OverrideDuplicateMoveLinkedMacro(bpy.types.Macro):
bl_idname = "bim.override_object_duplicate_move_linked_macro"