Add function grouped_by in Selector (#2515)

This commit is contained in:
Boris Brangeon
2022-10-19 09:49:06 +02:00
committed by GitHub
parent b2c5153c1c
commit 83bd0a973c
@@ -39,10 +39,11 @@ class Selector:
filter_value: ESCAPED_STRING | SIGNED_FLOAT | SIGNED_INT | BOOLEAN | NULL
pset_or_qto: /[^\\W][^.=<>]*[^\\W]/ "." /[^\\W][^.=<>]*[^\\W]/
lfunction: and | or
inverse_relationship: types | decomposed_by | bounded_by
inverse_relationship: types | decomposed_by | bounded_by | grouped_by
types: "*"
decomposed_by: "@"
bounded_by: "@@"
grouped_by: "@@@"
and: "&"
or: "|"
not: "!"
@@ -143,6 +144,8 @@ class Selector:
results.extend(element.ObjectTypeOf[0].RelatedObjects)
elif inverse_relationship == "decomposed_by":
results.extend(ifcopenshell.util.element.get_decomposition(element))
elif inverse_relationship == "grouped_by":
results.extend(ifcopenshell.util.element.get_grouped_by(element))
elif inverse_relationship == "bounded_by" and hasattr(element, "BoundedBy"):
for relationship in element.BoundedBy:
results.append(relationship.RelatedBuildingElement)