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.
This commit is contained in:
Ryan Schultz
2026-05-30 14:08:53 -05:00
committed by Thomas Krijnen
parent efcabed10d
commit 51ba331226
+25 -2
View File
@@ -19,6 +19,7 @@
import bpy import bpy
from bpy.types import Menu, Panel, UIList from bpy.types import Menu, Panel, UIList
import ifcopenshell.util.unit
import bonsai.bim import bonsai.bim
import bonsai.tool as tool import bonsai.tool as tool
from bonsai.bim.helper import prop_with_search from bonsai.bim.helper import prop_with_search
@@ -483,10 +484,32 @@ class BIM_PT_placement(Panel):
row.label(text="No Object Placement Found") row.label(text="No Object Placement Found")
return 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 = 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 = 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": if props.blender_offset_type != "NONE":
row = self.layout.row(align=True) row = self.layout.row(align=True)