mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 09:21:46 +00:00
ifcopenshell.util.get_constrained_elements
This commit is contained in:
@@ -38,6 +38,22 @@ def get_constraints(product: ifcopenshell.entity_instance) -> list[ifcopenshell.
|
||||
return constraints
|
||||
|
||||
|
||||
def get_constrained_elements(constraint: ifcopenshell.entity_instance) -> set[ifcopenshell.entity_instance]:
|
||||
"""
|
||||
Retrieves the elements constrained by a `constraint`.
|
||||
|
||||
:param product: The IFC element.
|
||||
:type product: ifcopenshell.entity_instance.entity_instance
|
||||
:return: Set of elements constrained by a `constrant`.
|
||||
:rtype: set[ifcopenshell.entity_instance.entity_instance]
|
||||
"""
|
||||
elements = set()
|
||||
for rel in constraint.file.get_inverse(constraint):
|
||||
if rel.is_a("IfcRelAssociatesConstraint"):
|
||||
elements.update(rel.RelatedObjects)
|
||||
return elements
|
||||
|
||||
|
||||
def get_metrics(constraint: ifcopenshell.entity_instance) -> list[ifcopenshell.entity_instance]:
|
||||
"""
|
||||
Retrieves the list of nested constraints for a IfcObjective `constraint`.
|
||||
|
||||
Reference in New Issue
Block a user