mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 17:58:20 +00:00
IFC selector now uses "class" as a keyword to get the IFC class to disambiguate between "type" and "class".
This commit is contained in:
@@ -267,7 +267,9 @@ class Selector:
|
||||
elif value.is_a("IfcMaterialConstituentSet"):
|
||||
value = value.MaterialConstituents
|
||||
elif key == "container":
|
||||
value = ifcopenshell.util.element.get_container(element)
|
||||
value = ifcopenshell.util.element.get_container(value)
|
||||
elif key == "class":
|
||||
value = value.is_a()
|
||||
elif isinstance(value, ifcopenshell.entity_instance):
|
||||
attribute = value.get_info().get(key, None)
|
||||
|
||||
|
||||
@@ -23,6 +23,11 @@ import ifcopenshell.util.selector as subject
|
||||
|
||||
|
||||
class TestGetElementValue(test.bootstrap.IFC4):
|
||||
def test_selecting_an_elements_class_or_id_using_a_query(self):
|
||||
element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWall")
|
||||
assert subject.get_element_value(element, "class") == "IfcWall"
|
||||
assert subject.get_element_value(element, "id") == element.id()
|
||||
|
||||
def test_selecting_an_elements_value_using_a_query(self):
|
||||
element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWall")
|
||||
element.Name = "Foobar"
|
||||
|
||||
Reference in New Issue
Block a user