From 9292aaaedfd362fe82aa91a68a24b35f89dfa667 Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Mon, 27 Dec 2021 15:09:39 +0100 Subject: [PATCH] Arch: Fixed units display of building parts --- src/Mod/Arch/ArchBuildingPart.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/Mod/Arch/ArchBuildingPart.py b/src/Mod/Arch/ArchBuildingPart.py index 5b8465b54c..940f76757c 100644 --- a/src/Mod/Arch/ArchBuildingPart.py +++ b/src/Mod/Arch/ArchBuildingPart.py @@ -32,6 +32,7 @@ if FreeCAD.GuiUp: import FreeCADGui from DraftTools import translate from PySide.QtCore import QT_TRANSLATE_NOOP + import draftutils.units as units else: # \cond def translate(ctxt,txt): @@ -783,14 +784,14 @@ class ViewProviderBuildingPart: else: u = q.getUserPreferred()[2] try: - q = q.getValueAs(u) + txt += units.display_external(float(q),None,'Length',vobj.ShowUnit,u) except Exception: q = q.getValueAs(q.getUserPreferred()[2]) - d = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Units").GetInt("Decimals",0) - fmt = "{0:."+ str(d) + "f}" - if not vobj.ShowUnit: - u = "" - txt += fmt.format(float(q)) + str(u) + d = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Units").GetInt("Decimals",0) + fmt = "{0:."+ str(d) + "f}" + if not vobj.ShowUnit: + u = "" + txt += fmt.format(float(q)) + str(u) if not txt: txt = " " # empty texts make coin crash... if isinstance(txt,unicode):