Test:
- Startup WB is Draft.
- Change the scale in the Annotation scale widget to "20:1"
- Restart FC.
- The scale is displayed as "20.0".
https://github.com/FreeCAD/FreeCAD/blob ... ar.py#L102
Code: Select all
>>> 0.2.as_integer_ratio()
(3602879701896397, 18014398509481984)
Code: Select all
def scale_to_label(scale):
"""
transform a float number into a 1:X or X:1 scale and return it as label
"""
f = round(scale, 2)
if f == 1.0:
return "1:1"
elif f > 1.0:
f = f.as_integer_ratio()
if f[1] == 1:
return str(f[0]) + ":1"
else:
return str(scale)
else:
f = 1/scale
f = round(f, 2)
f = f.as_integer_ratio()
if f[1] == 1:
return "1:" + str(f[0])
else:
return str(scale)
Code: Select all
OS: Windows 8.1 (6.3)
Word size of FreeCAD: 64-bit
Version: 0.20.25220 (Git)
Build type: Release
Branch: master
Hash: 46282db7c8c65d1205a4cd03499d4beadb1573c6
Python version: 3.8.10
Qt version: 5.12.9
Coin version: 4.0.0
OCC version: 7.5.2
Locale: Dutch/Netherlands (nl_NL)