mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-18 14:31:39 +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)
|
frac = Fraction(nearest, precision)
|
||||||
|
|
||||||
# If fraction is a whole number, format it accordingly
|
# If fraction is a whole number, format it accordingly
|
||||||
if frac.numerator == 0:
|
if frac.denominator == 1:
|
||||||
if imperial_unit == "inch":
|
if imperial_unit == "inch":
|
||||||
return f"{round(inches)}\""
|
return f"{round(inches)}\""
|
||||||
if suppress_zero_inches:
|
if suppress_zero_inches:
|
||||||
@@ -595,20 +595,13 @@ def format_length(
|
|||||||
elif not suppress_zero_inches:
|
elif not suppress_zero_inches:
|
||||||
if imperial_unit == "foot":
|
if imperial_unit == "foot":
|
||||||
return f"{round(value)}' - 0\""
|
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
|
remainder = frac.numerator % frac.denominator
|
||||||
whole = int((frac.numerator - remainder) / frac.denominator)
|
whole = int((frac.numerator - remainder) / frac.denominator)
|
||||||
if imperial_unit == "foot":
|
if imperial_unit == "foot":
|
||||||
if remainder == 0:
|
return f"{feet}' - {whole} {remainder}/{frac.denominator}\""
|
||||||
return f"{feet}' - {whole}\""
|
|
||||||
elif remainder != 0:
|
|
||||||
return f"{feet}' - {whole} {remainder}/{frac.denominator}\""
|
|
||||||
elif imperial_unit == "inch":
|
elif imperial_unit == "inch":
|
||||||
if remainder == 0:
|
return f"{whole} {remainder}/{frac.denominator}\""
|
||||||
return f"{whole}\""
|
|
||||||
elif remainder != 0:
|
|
||||||
return f"{whole} {remainder}/{frac.denominator}\""
|
|
||||||
|
|
||||||
|
|
||||||
elif unit_system == "metric":
|
elif unit_system == "metric":
|
||||||
rounded_val = round(value / precision) * precision
|
rounded_val = round(value / precision) * precision
|
||||||
|
|||||||
Reference in New Issue
Block a user