mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-20 15:08:51 +00:00
Deduplicate aggregates in select_aggregate clipboard query
All selected objects sharing the same aggregate would produce duplicate entries in the clipboard query. Aggregates are now collected into a dict keyed by id before selection and query generation. Generated with the assistance of an AI coding tool.
This commit is contained in:
@@ -282,19 +282,21 @@ class BIM_OT_select_aggregate(bpy.types.Operator):
|
|||||||
return self.execute(context)
|
return self.execute(context)
|
||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
all_parts = []
|
aggregates = {}
|
||||||
for obj in context.selected_objects:
|
for obj in context.selected_objects:
|
||||||
element = tool.Ifc.get_entity(obj)
|
element = tool.Ifc.get_entity(obj)
|
||||||
if element:
|
if element:
|
||||||
aggregate = ifcopenshell.util.element.get_aggregate(element)
|
aggregate = ifcopenshell.util.element.get_aggregate(element)
|
||||||
if aggregate:
|
if aggregate:
|
||||||
all_parts.append(aggregate)
|
aggregates[aggregate.id()] = aggregate
|
||||||
obj.select_set(False)
|
obj.select_set(False)
|
||||||
else:
|
else:
|
||||||
pass
|
pass
|
||||||
if not element:
|
if not element:
|
||||||
obj.select_set(False)
|
obj.select_set(False)
|
||||||
|
|
||||||
|
all_parts = list(aggregates.values())
|
||||||
|
|
||||||
if self.select_parts:
|
if self.select_parts:
|
||||||
selected_parts = []
|
selected_parts = []
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user