|
![]() |
(itoa 45) returns "45"
After (setq a 88)
(itoa 88) returns "88"
(atoi "15") returns 15
(atoi "14.9988") returns 14
After (setq a "35.625")
(atoi a) returns 35
(rtos 6.8 2 3) returns "6.800" (2 = decimal format, 3 = 3 place
accuracy)
After (setq m 85.0)
(rtos m 2 8) returns "85.00000000" (2 = decimal format, 8 = 8
place accuracy)
The first argument is the number as a real or integer.
The second argument determines the format mode:
1 for scientific
2 for decimal
3 for engineering (feet & decimal inches)
4 for architectural (feet & fractional inches)
5 for fractional
The 3rd argument determines the precision -- the number of places of accuracy, or the largest denominator in architectural and fractional format (0 for no fractions, I for halves, 2 for fourths, 3 for eighths, etc.).
If the second and third arguments are omitted, AutoLISP adopts the mode and precision currently in effect (according to the values in the system variables LUNITS and LUPREC, as set by the UNITS command).
The current setting of dimensioning variable DIMZIN can affect the form of the returned string when using engineering or architectural units.
(atof "2") returns 2.0
After (setq a "4.444")
(atof a) returns 4.444
The string cannot contain spaces or dashes, for example (atof "2 7/8")
returns 2.0. If you need to handle spaces or dashes, see distof below.
(distof "2 7/8") returns 2.875
(distof "2-7/8") returns 2.875
(distof "2.34e1") returns 23.4
Compare atof above.
After (setq a 0.436332)
(angtos a 0 4) returns "25.0"
(angtos a 1 4) returns "25d0'0""
(angtos a 2 5) returns "27.77776g"
(angtos a 3 3) returns "0.436r"
(angtos a 4 4) returns "N 65d0'0" E"
The first argument is the angle in radians, as a real or integer.
The second argument determines the format mode.
0 for degrees with decimal fraction
1 for degrees with minutes, seconds and decimal fraction of seconds
2 for grads
3 for radians
4 for surveyor's units
The third argument determines the precision -- the number of places to the right of the decimal point.
If the second and third arguments are omitted, AutoLISP adopts the mode and precision currently in effect (according to the values in the system variables AUNITS and AUPREC, as set by the UNITS command).
The current setting of dimensioning variable DIMZIN can affect the form
of the returned string when using engineering or architectural units.
(angtof "180") returns 3.14159 (assuming angular units is set
to degrees)
(angtof "200") returns 3.14159 (assuming angular units is set
to grads)
(angtof "180d0'0\"") returns 3.14159 (no matter what the current
setting of angular units is, since it reads the degrees-minutes-seconds
as part of the string)
(angtof "180") returns 2.82743 (assuming angular units is set
to grads)