mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 17:58:20 +00:00
New utility function for getting ports of an element
This commit is contained in:
@@ -34,3 +34,12 @@ def get_element_systems(element):
|
||||
]:
|
||||
results.append(rel.RelatingGroup)
|
||||
return results
|
||||
|
||||
|
||||
def get_ports(element):
|
||||
results = []
|
||||
for rel in getattr(element, "IsNestedBy", []) or []:
|
||||
results.extend([o for o in rel.RelatedObjects if o.is_a("IfcDistributionPort")])
|
||||
for rel in element.HasPorts or []:
|
||||
results.append(rel.RelatingPort)
|
||||
return results
|
||||
|
||||
Reference in New Issue
Block a user