mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-20 15:08:51 +00:00
Fix #3584. Support matching enumerated properties in new facet selector.
This commit is contained in:
@@ -294,7 +294,9 @@ class FacetTransformer(lark.Transformer):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
def compare(self, element_value, comparison, value):
|
def compare(self, element_value, comparison, value):
|
||||||
if isinstance(value, str):
|
if isinstance(element_value, (list, tuple)):
|
||||||
|
return any(self.compare(ev, comparison, value) for ev in element_value)
|
||||||
|
elif isinstance(value, str):
|
||||||
if isinstance(element_value, int):
|
if isinstance(element_value, int):
|
||||||
value = int(value)
|
value = int(value)
|
||||||
elif isinstance(element_value, float):
|
elif isinstance(element_value, float):
|
||||||
|
|||||||
@@ -137,6 +137,9 @@ class TestFilterElements(test.bootstrap.IFC4):
|
|||||||
ifcopenshell.api.run("pset.edit_pset", self.file, pset=pset, properties={"Baz": 123})
|
ifcopenshell.api.run("pset.edit_pset", self.file, pset=pset, properties={"Baz": 123})
|
||||||
assert subject.filter_elements(self.file, "IfcWall, Foobar.Baz=123") == {element}
|
assert subject.filter_elements(self.file, "IfcWall, Foobar.Baz=123") == {element}
|
||||||
ifcopenshell.api.run("pset.edit_pset", self.file, pset=pset, properties={"Bay": 123.3})
|
ifcopenshell.api.run("pset.edit_pset", self.file, pset=pset, properties={"Bay": 123.3})
|
||||||
|
pset = ifcopenshell.api.run("pset.add_pset", self.file, product=element, name="Pset_WallCommon")
|
||||||
|
ifcopenshell.api.run("pset.edit_pset", self.file, pset=pset, properties={"Status": ["New"]})
|
||||||
|
assert subject.filter_elements(self.file, "IfcWall, Pset_WallCommon.Status=New") == {element}
|
||||||
|
|
||||||
def test_selecting_by_classification(self):
|
def test_selecting_by_classification(self):
|
||||||
project = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcProject")
|
project = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcProject")
|
||||||
|
|||||||
Reference in New Issue
Block a user