Converts a number into a string
(rtos number [mode [precision]])
rtos function returns a string that is the representation of number according to the settings of mode, precision, and the system variables UNITMODE, DIMZIN, LUNITS, and LUPREC.
TheArguments
A number.
An integer specifying the linear units mode. The mode corresponds to the values allowed for the LUNITS AutoCAD system variable. The mode can be one of the following numbers:
1 Scientific
2 Decimal
3 Engineering (feet and decimal inches)
4 Architectural (feet and fractional inches)
5 Fractional
An integer specifying the precision.
rtos uses the current settings of LUNITS and LUPREC.
The mode and precision arguments correspond to the system variables LUNITS and LUPREC. If you omit the arguments,Return Values
A string. The UNITMODE system variable affects the returned string when engineering, architectural, or fractional units are selected (mode values 3, 4, or 5).
Examples
x:
Set variableCommand: (setq x 17.5)
17.5
x to a string in scientific format, with a precision of 4:
Convert the value ofCommand: (setq fmtval (rtos x 1 4))
"1.7500E+01"
x to a string in decimal format, with 2 decimal places:
Convert the value ofCommand: (setq fmtval (rtos x 2 2))
"17.50"
x to a string in engineering format, with a precision of 2:
Convert the value ofCommand: (setq fmtval (rtos x 3 2))
"1'-5.50\""
x to a string in architectural format:
Convert the value ofCommand: (setq fmtval (rtos x 4 2))
"1'-5 1/2\""
x to a string in fractional format:
Convert the value ofCommand: (setq fmtval (rtos x 5 2))
"17 1/2"
rtos for engineering, architectural, and fractional formats, as shown in the following examples:
Setting UNITMODE to 1 causes units to be displayed as entered. This affects the values returned byCommand: (setvar "unitmode" 1)
1
Command: (setq fmtval (rtos x 3 2))
"1'5.50\""
Command: (setq fmtval (rtos x 4 2))
"1'5-1/2\""
Command: (setq fmtval (rtos x 5 2))
"17-1/2"
String Conversions topic in the AutoLISP Developer's Guide .
The