mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-13 19:07:57 +00:00
bim.clone_opening - update affected representations
This commit is contained in:
@@ -1129,6 +1129,25 @@ class CloneOpening(Operator, tool.Ifc.Operator):
|
||||
|
||||
ifcopenshell.api.void.add_opening(ifc_file, opening=new_opening, element=voided_element)
|
||||
new_opening.ObjectPlacement = opening_placement
|
||||
|
||||
# Update affected representations.
|
||||
elements_to_update = tool.Aggregate.get_parts_recursively(voided_element)
|
||||
for element in elements_to_update:
|
||||
obj = tool.Ifc.get_object(element)
|
||||
if not isinstance(obj, bpy.types.Object) or not isinstance(obj.data, bpy.types.Mesh):
|
||||
continue
|
||||
representation = tool.Geometry.get_active_representation(obj)
|
||||
assert representation
|
||||
bonsai.core.geometry.switch_representation(
|
||||
tool.Ifc,
|
||||
tool.Geometry,
|
||||
obj=obj,
|
||||
representation=representation,
|
||||
should_reload=True,
|
||||
is_global=True,
|
||||
should_sync_changes_first=False,
|
||||
)
|
||||
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
|
||||
@@ -76,6 +76,7 @@ class Aggregate(bonsai.core.tool.Aggregate):
|
||||
|
||||
@classmethod
|
||||
def get_parts_recursively(cls, element: ifcopenshell.entity_instance) -> set[ifcopenshell.entity_instance]:
|
||||
"""Get elements parts recursively, resulting set includes `element`."""
|
||||
parts = set()
|
||||
queue = {element}
|
||||
while queue:
|
||||
@@ -122,7 +123,6 @@ class Aggregate(bonsai.core.tool.Aggregate):
|
||||
editing_obj = props.editing_objects.add()
|
||||
editing_obj.obj = obj.original
|
||||
|
||||
|
||||
props.in_aggregate_mode = True
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user