New utility function to get storey elevations with elevation attribute fallback for more compliant sorting of building storey elevations.

This commit is contained in:
Dion Moult
2021-10-18 12:39:04 +11:00
parent a9a48bdd1d
commit 699ccddda3
4 changed files with 75 additions and 46 deletions
@@ -0,0 +1,25 @@
import ifcopenshell
import test.bootstrap
import ifcopenshell.util.placement as subject
class TestGetStoreyElevationIFC4(test.bootstrap.IFC4):
def test_run(self):
storey = self.file.createIfcBuildingStorey()
placement = self.file.createIfcLocalPlacement()
placement.RelativePlacement = self.file.createIfcAxis2Placement3D(
self.file.createIfcCartesianPoint((0.0, 0.0, 3.0))
)
storey.ObjectPlacement = placement
assert subject.get_storey_elevation(storey) == 3.0
def test_getting_the_elevation_if_no_z_location(self):
storey = self.file.createIfcBuildingStorey()
storey.Elevation = 3.0
assert subject.get_storey_elevation(storey) == 3.0
def test_returning_0_as_a_fallback(self):
storey = self.file.createIfcBuildingStorey()
assert subject.get_storey_elevation(storey) == 0.0
building = self.file.createIfcBuilding()
assert subject.get_storey_elevation(building) == 0.0