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:
Andrej730
2024-05-17 15:25:39 +05:00
parent 9f7d710119
commit 25c1a14e64
2 changed files with 19 additions and 2 deletions
@@ -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):