From 57bc709b6fef6381bbb2810da15e568290c4a77a Mon Sep 17 00:00:00 2001 From: Ryan Schultz Date: Sat, 22 Nov 2025 14:39:13 -0600 Subject: [PATCH] Fix imperial unit conversion for plan and section level decorators Level annotations were incorrectly converting feet to meters and back, causing values like 3ft to display as 9'10". Updated format_value() to accept in_unit_length parameter and pass it to format_distance(), since Blender's Z coordinates are already in project units. - Add in_unit_length parameter to BaseDecorator.format_value() - Set in_unit_length=True in PlanLevelDecorator.draw_labels() - Set in_unit_length=True in SectionLevelDecorator.draw_labels() --- src/bonsai/bonsai/bim/module/drawing/decoration.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/bonsai/bonsai/bim/module/drawing/decoration.py b/src/bonsai/bonsai/bim/module/drawing/decoration.py index 8f15282bc4..88c6d063e5 100644 --- a/src/bonsai/bonsai/bim/module/drawing/decoration.py +++ b/src/bonsai/bonsai/bim/module/drawing/decoration.py @@ -489,7 +489,7 @@ class BaseDecorator: self.draw_label(context, text=text, line_no=line_number_start, multiline=True, **draw_label_kwargs) @cache - def format_value(self, context, value, suppress_zero_inches=False, custom_unit=None): + def format_value(self, context, value, suppress_zero_inches=False, custom_unit=None, in_unit_length=False): drawing_pset_data = DrawingsData.data["active_drawing_pset_data"] precision = drawing_pset_data.get("MetricPrecision", None) if not precision: @@ -502,6 +502,7 @@ class BaseDecorator: decimal_places=decimal_places, suppress_zero_inches=suppress_zero_inches, custom_unit=custom_unit, + in_unit_length=in_unit_length, ) def draw_asterisk(self, context: bpy.types.Context, pos: Vector, rotation: float = 0.0, scale: float = 1.0) -> None: @@ -1203,7 +1204,7 @@ class PlanLevelDecorator(BaseDecorator): abs_z = verts[0].z z = helper.get_relative_z(obj, element, abs_z) - rl = self.format_value(context, z) + rl = self.format_value(context, z, in_unit_length=True) text = "{}{}".format("" if z < 0 else "+", rl) return text @@ -1276,7 +1277,7 @@ class SectionLevelDecorator(BaseDecorator): def get_text(): z = verts[0].z - rl = self.format_value(context, z) + rl = self.format_value(context, z, in_unit_length=True) text = "RL {}{}".format("" if z < 0 else "+", rl) return text @@ -1291,7 +1292,6 @@ class SectionLevelDecorator(BaseDecorator): ) break # support only 1 label - class BreakDecorator(BaseDecorator): """Decorator for breakline objects - first edge of a mesh with zigzag thingy in the middle