mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-19 14:41:25 +00:00
add to https://github.com/IfcOpenShell/IfcOpenShell/commit/57bc709b6fef6381bbb2810da15e568290c4a77a: Fix elevation display by converting from project units to meters on import
When importing spatial decomposition, get_storey_elevation() returns values in the project's unit system (e.g., feet), but format_distance() expects values in meters. Added unit_scale conversion (elevation * unit_scale) before formatting to ensure elevations display correctly regardless of project units.
This commit is contained in:
@@ -496,7 +496,9 @@ class Spatial(bonsai.core.tool.Spatial):
|
|||||||
new.long_name = element.LongName or ""
|
new.long_name = element.LongName or ""
|
||||||
if not element.is_a("IfcProject"):
|
if not element.is_a("IfcProject"):
|
||||||
elevation = ifcopenshell.util.placement.get_storey_elevation(element)
|
elevation = ifcopenshell.util.placement.get_storey_elevation(element)
|
||||||
new["elevation"] = tool.Unit.format_distance(elevation)
|
unit_scale = ifcopenshell.util.unit.calculate_unit_scale(tool.Ifc.get())
|
||||||
|
elevation_in_meters = elevation * unit_scale
|
||||||
|
new.elevation = tool.Unit.format_distance(elevation_in_meters)
|
||||||
new.is_expanded = element.id() not in cls.contracted_containers
|
new.is_expanded = element.id() not in cls.contracted_containers
|
||||||
new.level_index = level_index
|
new.level_index = level_index
|
||||||
children = ifcopenshell.util.element.get_parts(element)
|
children = ifcopenshell.util.element.get_parts(element)
|
||||||
|
|||||||
Reference in New Issue
Block a user