recreates assembly for array children objects

This commit is contained in:
Bruno Perdigão
2023-10-23 15:46:14 -03:00
parent 37ab9c80e3
commit ef72cd3250
@@ -858,17 +858,30 @@ class OverrideDuplicateMove(bpy.types.Operator):
@staticmethod
def recreate_assembly(old_to_new):
for old_element, new_element in old_to_new.items():
old_parent = ifcopenshell.util.element.get_aggregate(old_element)
if old_parent:
new_parent = old_to_new[old_parent]
for old, new in old_to_new.items():
old_aggregate = ifcopenshell.util.element.get_aggregate(old)
if old_aggregate:
new_aggregate = old_to_new[old_aggregate]
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]),
relating_obj=tool.Ifc.get_object(new_aggregate[0]),
related_obj=tool.Ifc.get_object(new[0]),
)
# Make sure that the array children also get reassigned to the correct aggregate
pset = ifcopenshell.util.element.get_pset(new[0], "BBIM_Array")
if pset:
array_children = tool.Blender.Modifier.Array.get_all_children_objects(new[0])
for obj in array_children:
blenderbim.core.aggregate.assign_object(
tool.Ifc,
tool.Aggregate,
tool.Collector,
relating_obj=tool.Ifc.get_object(new_aggregate[0]),
related_obj=tool.Ifc.get_object(tool.Ifc.get_entity(obj)),
)
def remove_old_connections(old_to_new):
for new in old_to_new.values():