mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-20 23:36:20 +00:00
bim.show_opening - simplify code
This commit is contained in:
@@ -489,22 +489,10 @@ class ShowOpenings(Operator, tool.Ifc.Operator):
|
|||||||
bl_options = {"REGISTER", "UNDO"}
|
bl_options = {"REGISTER", "UNDO"}
|
||||||
|
|
||||||
def _execute(self, context):
|
def _execute(self, context):
|
||||||
objs = list(context.selected_objects)
|
for obj in tool.Blender.get_selected_objects():
|
||||||
# If several parts of an aggregation are selected, the aggregate openings may be queried more than once
|
|
||||||
objects_element_map: set[tuple[bpy.types.Object, ifcopenshell.entity_instance]] = set()
|
|
||||||
while objs:
|
|
||||||
obj = objs.pop(0)
|
|
||||||
element = tool.Ifc.get_entity(obj)
|
element = tool.Ifc.get_entity(obj)
|
||||||
if element:
|
if element is None:
|
||||||
if getattr(element, "Decomposes", None):
|
continue
|
||||||
# Select aggregate recursively
|
|
||||||
if element.Decomposes and (aggregate := element.Decomposes[0].RelatingObject):
|
|
||||||
aggregate_obj = tool.Ifc.get_object(aggregate)
|
|
||||||
assert isinstance(aggregate_obj, bpy.types.Object)
|
|
||||||
objs.append(aggregate_obj)
|
|
||||||
objects_element_map.add((obj, element))
|
|
||||||
|
|
||||||
for obj, element in objects_element_map:
|
|
||||||
self.show_object_openings(obj, element)
|
self.show_object_openings(obj, element)
|
||||||
DecorationsHandler.install(bpy.context)
|
DecorationsHandler.install(bpy.context)
|
||||||
bpy.ops.bim.update_openings_focus()
|
bpy.ops.bim.update_openings_focus()
|
||||||
|
|||||||
Reference in New Issue
Block a user