mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-29 11:46:33 +00:00
a better implementation for #3731 - to round to the nearest foot.
This commit is contained in:
@@ -202,6 +202,7 @@ def format_distance(
|
|||||||
|
|
||||||
base = int(precision)
|
base = int(precision)
|
||||||
decInches = value * toInches
|
decInches = value * toInches
|
||||||
|
decFeet = decInches/12
|
||||||
|
|
||||||
# Separate ft and inches
|
# Separate ft and inches
|
||||||
# Unless Inches are the specified Length Unit or unit_fraction is False
|
# Unless Inches are the specified Length Unit or unit_fraction is False
|
||||||
@@ -272,8 +273,8 @@ def format_distance(
|
|||||||
tx_dist += str(frac) + "/" + str(base)
|
tx_dist += str(frac) + "/" + str(base)
|
||||||
if add_inches or frac:
|
if add_inches or frac:
|
||||||
tx_dist += '"'
|
tx_dist += '"'
|
||||||
if precision == "12":
|
if precision == "12" and unit_system == "IMPERIAL":
|
||||||
tx_dist = str(feet) + "'"
|
tx_dist = str(round(decFeet)) + "'"
|
||||||
else:
|
else:
|
||||||
fmt = "%1.3f"
|
fmt = "%1.3f"
|
||||||
sq_feet = round(value * toInches / inPerFoot, 4)
|
sq_feet = round(value * toInches / inPerFoot, 4)
|
||||||
|
|||||||
Reference in New Issue
Block a user