mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 01:41:57 +00:00
Fix #1792. Regression caused by other improvements in editing object placement.
This commit is contained in:
@@ -85,6 +85,37 @@ class TestEditObjectPlacement(test.bootstrap.IFC4):
|
||||
with pytest.raises(RuntimeError):
|
||||
self.file.by_id(element_id)
|
||||
|
||||
def test_changing_an_object_placement_used_by_other_products(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="IfcWall")
|
||||
element2 = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWall")
|
||||
matrix1 = numpy.array(
|
||||
(
|
||||
(1.0, 0.0, 0.0, 1.0),
|
||||
(0.0, 1.0, 0.0, 2.0),
|
||||
(0.0, 0.0, 1.0, 3.0),
|
||||
(0.0, 0.0, 0.0, 1.0),
|
||||
)
|
||||
)
|
||||
matrix2 = numpy.array(
|
||||
(
|
||||
(1.0, 0.0, 0.0, 4.0),
|
||||
(0.0, 1.0, 0.0, 5.0),
|
||||
(0.0, 0.0, 1.0, 6.0),
|
||||
(0.0, 0.0, 0.0, 1.0),
|
||||
)
|
||||
)
|
||||
ifcopenshell.api.run(
|
||||
"geometry.edit_object_placement", self.file, product=element, matrix=matrix1.copy(), is_si=False
|
||||
)
|
||||
element2.ObjectPlacement = element.ObjectPlacement
|
||||
ifcopenshell.api.run(
|
||||
"geometry.edit_object_placement", self.file, product=element, matrix=matrix2.copy(), is_si=False
|
||||
)
|
||||
assert numpy.array_equal(ifcopenshell.util.placement.get_local_placement(element.ObjectPlacement), matrix2)
|
||||
assert element.ObjectPlacement != element2.ObjectPlacement
|
||||
|
||||
def test_changing_placements_relative_to_a_spatial_container(self):
|
||||
ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcProject")
|
||||
ifcopenshell.api.run("unit.assign_unit", self.file)
|
||||
|
||||
Reference in New Issue
Block a user