mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-12 18:43:26 +00:00
New utility function to get storey elevations with elevation attribute fallback for more compliant sorting of building storey elevations.
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user