distof

AutoCad AutoLISP Functions

 
distof
 
 
 

Converts a string that represents a real (floating-point) value into a real value

(distof string [mode])

The distof and rtos functions are complementary. If you pass distof a string created by rtos, distof is guaranteed to return a valid value, and vice versa (assuming the mode values are the same).

Arguments

string

A string to be converted. The argument must be a string that distof can parse correctly according to the units specified by mode. It can be in the same form that rtos returns, or in a form that AutoCAD allows for keyboard entry.

mode

The units in which the string is currently formatted. The mode corresponds to the values allowed for the AutoCAD system variable LUNITS in the Command Reference. Specify one of the following numbers for mode:

1 Scientific

2 Decimal

3 Engineering (feet and decimal inches)

4 Architectural (feet and fractional inches)

5 Fractional

Return Values

A real number, if successful; otherwise nil.

NoteThe distof function treats modes 3 and 4 the same. That is, if mode specifies 3 (engineering) or 4 (architectural) units, and string is in either of these formats, distof returns the correct real value.