The Units struct provides access to system global variables and some methods to get and set the System Units scale, type, and Display Units.
Gets/sets the current unit display type as a <name>.
Gets/sets the current metric unit display type as a <name>.
Valid metric unit display types are:
Gets/sets the current US standard unit display type as a <name>.
Valid US standard unit display types are:
units.USFrac
Gets/sets the current US fraction display type as a <name>.
Valid US fraction display types are:
Gets/sets the current custom unit name as a <string>.
Gets/sets the current custom unit value as a <float>.
Gets/sets the current custom unit type as a <name>.
Valid custom unit display types are:
Gets/sets the current system unit scale value as a <float>.
This is the value shown in Customize Units Setup > System Units Setup > System Units Scale group.
Gets/sets the current system unit scale type as a <name>.
This is the unit shown in Customize > Units Setup > System Units Setup > System Units Scale group.
Valid system unit scale types are:
Returns a <string> value representing the <float> in the current unit scale.
This method can cause a string overflow, especially when the units are set to miles or kilometers.
If an overflow occurs a run-time error is thrown.
Parses <string> using the current unit settings and returns a <float>.
A run-time error is thrown if an error occurs in the parsing of the string.
This is the inverse function of units.formatValue() described above.
The back and forth conversion of values can lead to precision loss due to rounding errors.