From 51ba3312267cd30773275ef068f3fa489db47703 Mon Sep 17 00:00:00 2001 From: Ryan Schultz Date: Sat, 30 May 2026 14:08:53 -0500 Subject: [PATCH] Closes #8127: Add imperial location display to Placement panel In the Placement panel, show Location and Rotation X/Y/Z each on their own row beneath a header label. When the IFC file uses imperial units, display a read-only feet-and-inches label alongside each Location input field. Generated with the assistance of an AI coding tool. --- src/bonsai/bonsai/bim/module/geometry/ui.py | 27 +++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/src/bonsai/bonsai/bim/module/geometry/ui.py b/src/bonsai/bonsai/bim/module/geometry/ui.py index e7912c7a77..212e6ca74b 100644 --- a/src/bonsai/bonsai/bim/module/geometry/ui.py +++ b/src/bonsai/bonsai/bim/module/geometry/ui.py @@ -19,6 +19,7 @@ import bpy from bpy.types import Menu, Panel, UIList +import ifcopenshell.util.unit import bonsai.bim import bonsai.tool as tool from bonsai.bim.helper import prop_with_search @@ -483,10 +484,32 @@ class BIM_PT_placement(Panel): row.label(text="No Object Placement Found") return + is_imperial = False + if tool.Ifc.get(): + length_unit = ifcopenshell.util.unit.get_project_unit(tool.Ifc.get(), "LENGTHUNIT") + if length_unit and length_unit.Name != "METRE": + is_imperial = True + row = self.layout.row() - row.prop(context.active_object, "location", text="Location") + row.label(text="Location:") + + if is_imperial: + loc = context.active_object.location + for i, (axis, comp) in enumerate(zip("XYZ", (loc.x, loc.y, loc.z))): + split = self.layout.split(factor=0.6) + split.prop(context.active_object, "location", index=i, text=axis) + sub = split.row() + sub.enabled = False + sub.alignment = "LEFT" + sub.label(text=tool.Unit.format_distance(comp)) + else: + for i, axis in enumerate("XYZ"): + self.layout.prop(context.active_object, "location", index=i, text=axis) + row = self.layout.row() - row.prop(context.active_object, "rotation_euler", text="Rotation") + row.label(text="Rotation:") + for i, axis in enumerate("XYZ"): + self.layout.prop(context.active_object, "rotation_euler", index=i, text=axis) if props.blender_offset_type != "NONE": row = self.layout.row(align=True)