mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 01:41:57 +00:00
Fix bug where assigning a spatial container didn't work with non local placements
This commit is contained in:
@@ -45,7 +45,8 @@ class Usecase:
|
||||
}
|
||||
)
|
||||
|
||||
if getattr(self.settings["product"], "ObjectPlacement", None):
|
||||
placement = getattr(self.settings["product"], "ObjectPlacement", None)
|
||||
if placement and placement.is_a("IfcLocalPlacement"):
|
||||
ifcopenshell.api.run(
|
||||
"geometry.edit_object_placement",
|
||||
self.file,
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user