Fix bug where assigning a spatial container didn't work with non local placements

This commit is contained in:
Dion Moult
2021-10-05 16:00:26 +11:00
parent f284ae5753
commit c105b8f3a7
7 changed files with 22 additions and 11 deletions
@@ -76,4 +76,15 @@ class TestEditObjectPlacement(test.bootstrap.IFC4):
"geometry.edit_object_placement", self.file, product=subelement, matrix=matrix1.copy(), is_si=False
)
ifcopenshell.api.run("spatial.assign_container", self.file, product=subelement, relating_structure=element2)
assert subelement.ObjectPlacement.PlacementRelTo.PlacesObject[0] == element2
assert numpy.array_equal(ifcopenshell.util.placement.get_local_placement(subelement.ObjectPlacement), matrix1)
def test_not_updating_placement_if_placement_is_not_relative(self):
ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcProject")
ifcopenshell.api.run("unit.assign_unit", self.file)
element = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcBuilding")
subelement = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWall")
placement = self.file.createIfcGridPlacement()
subelement.ObjectPlacement = placement
ifcopenshell.api.run("spatial.assign_container", self.file, product=subelement, relating_structure=element)
assert subelement.ObjectPlacement == placement