mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
Fix #2187. ifc_duplicate_operator now recreates the IfcElementAssembly structure into a new Assembly
This commit is contained in:
@@ -819,6 +819,11 @@ class OverrideDuplicateMove(bpy.types.Operator):
|
||||
if new.is_a("IfcRelSpaceBoundary"):
|
||||
tool.Boundary.decorate_boundary(new_obj)
|
||||
|
||||
# Recreate assembly relationship
|
||||
for old in old_to_new.keys():
|
||||
if old.is_a("IfcElementAssembly"):
|
||||
OverrideDuplicateMove.recreate_assembly(old_to_new)
|
||||
|
||||
# Recreate decompositions
|
||||
tool.Root.recreate_decompositions(relationships, old_to_new)
|
||||
blenderbim.bim.handler.refresh_ui_data()
|
||||
@@ -860,6 +865,22 @@ class OverrideDuplicateMove(bpy.types.Operator):
|
||||
|
||||
return arrays_to_create, array_children
|
||||
|
||||
@staticmethod
|
||||
def recreate_assembly(old_to_new):
|
||||
for old_element, new_element in old_to_new.items():
|
||||
print(old_element, new_element)
|
||||
old_parent = ifcopenshell.util.element.get_aggregate(old_element)
|
||||
if old_parent:
|
||||
new_parent = old_to_new[old_parent]
|
||||
print(new_parent)
|
||||
blenderbim.core.aggregate.assign_object(
|
||||
tool.Ifc,
|
||||
tool.Aggregate,
|
||||
tool.Collector,
|
||||
relating_obj=tool.Ifc.get_object(new_parent[0]),
|
||||
related_obj=tool.Ifc.get_object(new_element[0]),
|
||||
)
|
||||
|
||||
|
||||
class OverrideDuplicateMoveLinkedMacro(bpy.types.Macro):
|
||||
bl_idname = "bim.override_object_duplicate_move_linked_macro"
|
||||
|
||||
Reference in New Issue
Block a user