From bfd5b1bede1772032014b024587449e3be52e814 Mon Sep 17 00:00:00 2001 From: Ryan Schultz Date: Sat, 22 Nov 2025 16:53:28 -0600 Subject: [PATCH] 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. --- src/bonsai/bonsai/tool/spatial.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/bonsai/bonsai/tool/spatial.py b/src/bonsai/bonsai/tool/spatial.py index f21375cd63..a177a237e8 100644 --- a/src/bonsai/bonsai/tool/spatial.py +++ b/src/bonsai/bonsai/tool/spatial.py @@ -496,7 +496,9 @@ class Spatial(bonsai.core.tool.Spatial): new.long_name = element.LongName or "" if not element.is_a("IfcProject"): 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.level_index = level_index children = ifcopenshell.util.element.get_parts(element)