From 97a501036b43ef432ec511f332978bb40d77e68a Mon Sep 17 00:00:00 2001 From: Ryan Schultz Date: Sun, 23 Nov 2025 18:22:40 -0600 Subject: [PATCH] Have dimensions like `4' - 1/2"` read like `4' - 0 1/2"`, as is more the convention. --- src/ifcopenshell-python/ifcopenshell/util/unit.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ifcopenshell-python/ifcopenshell/util/unit.py b/src/ifcopenshell-python/ifcopenshell/util/unit.py index a364ed2467..cc767fe3a7 100644 --- a/src/ifcopenshell-python/ifcopenshell/util/unit.py +++ b/src/ifcopenshell-python/ifcopenshell/util/unit.py @@ -773,8 +773,9 @@ def format_length( if output_unit == "foot": return f"{feet}' - {whole} {remainder}/{frac.denominator}\"" return f'{(feet * 12) + whole} {remainder}/{frac.denominator}"' + # When we have a proper fraction (numerator < denominator), show "0 frac" if output_unit == "foot": - return f"{feet}' - {frac.numerator}/{frac.denominator}\"" + return f"{feet}' - 0 {frac.numerator}/{frac.denominator}\"" return f'{feet * 12} {frac.numerator}/{frac.denominator}"' elif unit_system == "metric": rounded_val = round(value / precision) * precision