From d71e89f8235d6453349c98c8bd2cb71f9942e649 Mon Sep 17 00:00:00 2001 From: Boris Brangeon Date: Wed, 4 Aug 2021 11:55:51 +0200 Subject: [PATCH] Update selector.py (#1627) Add new inverse_relationship ==> boundedby If Entity IfcRelSpaceBoundary exist then hasattr(element, "BoundedBy") is True and relationship.RelatedBuildingElement exist. New Rule Lark : "@@ .IfcSpace[Name *= \"Bedroom\"] & .IfcSlab" --- src/ifcopenshell-python/ifcopenshell/util/selector.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ifcopenshell-python/ifcopenshell/util/selector.py b/src/ifcopenshell-python/ifcopenshell/util/selector.py index dd7fc99c4d..bfdc50c1d0 100644 --- a/src/ifcopenshell-python/ifcopenshell/util/selector.py +++ b/src/ifcopenshell-python/ifcopenshell/util/selector.py @@ -20,9 +20,10 @@ class Selector: filter_value: ESCAPED_STRING pset_or_qto: /[A-Za-z0-9_]+/ "." /[A-Za-z0-9_]+/ lfunction: and | or - inverse_relationship: types | contains_elements + inverse_relationship: types | contains_elements | boundedby types: "*" contains_elements: "@" + boundedby: "@@" and: "&" or: "|" comparison: contains | morethanequalto | lessthanequalto | equal | morethan | lessthan @@ -116,6 +117,9 @@ class Selector: elif inverse_relationship == "contains_elements" and hasattr(element, "ContainsElements"): for relationship in element.ContainsElements: results.extend(relationship.RelatedElements) + elif inverse_relationship == "boundedby" and hasattr(element, "BoundedBy"): + for relationship in element.BoundedBy: + results.append(relationship.RelatedBuildingElement) return results def get_class_selector(self, class_selector):