mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
Add IsGroupedBy in function get_decomposition (#2513)
* Add IsGroupedBy in function get_decomposition selector example : "@ .IfcZone & .IfcSpace" * Update element.py * Change name function get_group get_group to get_grouped_by
This commit is contained in:
@@ -376,7 +376,27 @@ def get_decomposition(element):
|
||||
results.append(rel.RelatedBuildingElement)
|
||||
return results
|
||||
|
||||
def get_grouped_by(element):
|
||||
"""
|
||||
Retrieves all subelements of an element based on the group.
|
||||
|
||||
:param element: The IFC element
|
||||
:return: All subelements of the group
|
||||
|
||||
Example::
|
||||
|
||||
element = file.by_type("IfcGroup")[0]
|
||||
subelements = ifcopenshell.util.element.get_group(element)
|
||||
"""
|
||||
queue = [element]
|
||||
results = []
|
||||
while queue:
|
||||
element = queue.pop()
|
||||
for rel in getattr(element, "IsGroupedBy", []):
|
||||
queue.extend(rel.RelatedObjects)
|
||||
results.extend(rel.RelatedObjects)
|
||||
return results
|
||||
|
||||
def get_aggregate(element):
|
||||
"""
|
||||
Retrieves the aggregate of an element.
|
||||
|
||||
Reference in New Issue
Block a user