Go to: Synopsis. Return value. Flags. MEL examples.

Synopsis

convertUnit [-fromUnit string] [-toUnit string] string

convertUnit is undoable, NOT queryable, and NOT editable.

This command converts values between different units of measure. The command takes a string, because a string can incorporate unit names as well as values (see examples).

Return value

floator string

Flags

fromUnit, toUnit
Long name (short name) Argument types Properties
-fromUnit(-f) string create
The unit to convert from. If not supplied, it is assumed to be the system default. The from unit may also be supplied as part of the value e.g. 11.2m (11.2 meters).
-toUnit(-t) string create
The unit to convert to. If not supplied, it is assumed to be the system default

Flag can appear in Create mode of command Flag can appear in Edit mode of command
Flag can appear in Query mode of command Flag can be used more than once in a command.

MEL examples

// Returns string "4.80315in", which is 12.2cm in inches.
convertUnit -fromUnit "cm" -toUnit "in" "12.2";

// Returns string "3.499563yd", which is 3.2m in yards.
convertUnit -toUnit "yard" "3.2m";

// Returns float value 13.716, which is 5.4 inches in cm (default system units).
convertUnit -fromUnit "inch" "5.4";