mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 17:58:20 +00:00
set_element_value - pass attr value to the next part of the query #4495
E.g. previously set_element_value with query "material.item.Material.Name" would fail with error "Material property is expecting an IFC entity and not a string". But now it will detect that "Material" property is not a last key in the query and will pass `.Material` value forward and try to set it's `.Name` attribute with value. The main goal is to make sure get_element_value and set_element_value would have a same result for same queries.
This commit is contained in:
@@ -311,6 +311,13 @@ class TestSetElementValue(test.bootstrap.IFC4):
|
||||
subject.set_element_value(self.file, element, "Name", 123)
|
||||
assert element.Name == "123"
|
||||
|
||||
def test_set_attributes_attribute(self):
|
||||
material = self.file.create_entity("IfcMaterial")
|
||||
layer = self.file.create_entity("IfcMaterialLayer")
|
||||
layer.Material = material
|
||||
subject.set_element_value(self.file, layer, "Material.Name", "Foo")
|
||||
assert material.Name == "Foo"
|
||||
|
||||
|
||||
class TestSelector(test.bootstrap.IFC4):
|
||||
def test_selecting_from_specified_elements(self):
|
||||
|
||||
Reference in New Issue
Block a user