mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
Revert "Small fix for feet and inch formatting on Spreadsheet Import/Export"
This reverts commit 7935bd22c2.
This commit is contained in:
@@ -586,7 +586,7 @@ def format_length(
|
||||
frac = Fraction(nearest, precision)
|
||||
|
||||
# If fraction is a whole number, format it accordingly
|
||||
if frac.numerator == 0:
|
||||
if frac.denominator == 1:
|
||||
if imperial_unit == "inch":
|
||||
return f"{round(inches)}\""
|
||||
if suppress_zero_inches:
|
||||
@@ -595,20 +595,13 @@ def format_length(
|
||||
elif not suppress_zero_inches:
|
||||
if imperial_unit == "foot":
|
||||
return f"{round(value)}' - 0\""
|
||||
if frac.numerator > frac.denominator:
|
||||
if frac.numerator > frac.denominator and not frac.denominator == 0:
|
||||
remainder = frac.numerator % frac.denominator
|
||||
whole = int((frac.numerator - remainder) / frac.denominator)
|
||||
if imperial_unit == "foot":
|
||||
if remainder == 0:
|
||||
return f"{feet}' - {whole}\""
|
||||
elif remainder != 0:
|
||||
return f"{feet}' - {whole} {remainder}/{frac.denominator}\""
|
||||
return f"{feet}' - {whole} {remainder}/{frac.denominator}\""
|
||||
elif imperial_unit == "inch":
|
||||
if remainder == 0:
|
||||
return f"{whole}\""
|
||||
elif remainder != 0:
|
||||
return f"{whole} {remainder}/{frac.denominator}\""
|
||||
|
||||
return f"{whole} {remainder}/{frac.denominator}\""
|
||||
|
||||
elif unit_system == "metric":
|
||||
rounded_val = round(value / precision) * precision
|
||||
|
||||
Reference in New Issue
Block a user