See #6030. You can now select elements in groups recursively.

This commit is contained in:
Dion Moult
2025-01-25 14:11:42 +11:00
parent a2a4da596f
commit 38835a4092
4 changed files with 18 additions and 30 deletions
@@ -1000,7 +1000,9 @@ def get_decomposition(element: ifcopenshell.entity_instance, is_recursive=True)
return results
def get_grouped_by(element: ifcopenshell.entity_instance) -> list[ifcopenshell.entity_instance]:
def get_grouped_by(
element: ifcopenshell.entity_instance, is_recursive: bool = True
) -> list[ifcopenshell.entity_instance]:
"""Retrieves all subelements of an element based on the group.
:param element: IfcGroup entity
@@ -1021,6 +1023,8 @@ def get_grouped_by(element: ifcopenshell.entity_instance) -> list[ifcopenshell.e
related_objects = rel.RelatedObjects
queue.extend(related_objects)
results.extend(related_objects)
if not is_recursive:
break
return results