mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 09:21:46 +00:00
Fix #2945. Selector should expand enumerated list properties so that you can match any of them.
This commit is contained in:
@@ -293,7 +293,10 @@ class Selector:
|
||||
results = []
|
||||
for prop_name, prop_value in value.items():
|
||||
if re.match(key, prop_name):
|
||||
results.append(prop_value)
|
||||
if isinstance(prop_value, (list, tuple)):
|
||||
results.extend(prop_value)
|
||||
else:
|
||||
results.append(prop_value)
|
||||
value = results
|
||||
else:
|
||||
value = value.get(key, None)
|
||||
|
||||
@@ -88,6 +88,7 @@ class TestSelector(test.bootstrap.IFC4):
|
||||
ifcopenshell.api.run("pset.edit_pset", self.file, pset=pset, properties={"Foo": "Bar"})
|
||||
assert subject.Selector.parse(self.file, ".IfcElement[Foo_Bar.Foo]") == [element]
|
||||
assert subject.Selector.parse(self.file, ".IfcElement[Foo_Bar.Fox]") == []
|
||||
assert subject.Selector.parse(self.file, '.IfcElement[r"Foo.*ar"."Fo.*"]') == [element]
|
||||
|
||||
def test_selecting_by_string_property(self):
|
||||
element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWall")
|
||||
|
||||
Reference in New Issue
Block a user