- UID
- 458
- 积分
- 0
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2002-1-13
- 最后登录
- 1970-1-1
|
发表于 2003-6-6 15:15:45
|
显示全部楼层
只要熟悉一下rtos这个lsp函数,就明白了,
改动片段为
;;提取点piont1的X、Y坐标并分别转换为字符串
(setq ptx1 (rtos (car pt1) 2 2))
(setq pty1 (rtos (cadr pt1) 2 2))
(SETQ PTZ1 (Rtos (CADDR PT1) 2 2))
以下是rtos函数的英文帮助,请你好看一看
rtos:
rtos Function
Converts a number into a string
(rtos number [mode [precision]])
The 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.
Arguments
number
A number.
mode
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
precision
An integer specifying the precision.
The mode and precision arguments correspond to the system variables LUNITS and LUPREC. If you omit the arguments, rtos uses the current settings of LUNITS and LUPREC.
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
Set variable x:
Command: (setq x 17.5)
17.5
Convert the value of x to a string in scientific format, with a precision of 4:
Command: (setq fmtval (rtos x 1 4))
"1.7500E+01"
Convert the value of x to a string in decimal format, with 2 decimal places:
Command: (setq fmtval (rtos x 2 2))
"17.50"
Convert the value of x to a string in engineering format, with a precision of 2:
Command: (setq fmtval (rtos x 3 2))
"1'-5.50\""
Convert the value of x to a string in architectural format:
Command: (setq fmtval (rtos x 4 2))
"1'-5 1/2\""
Convert the value of x to a string in fractional format:
Command: (setq fmtval (rtos x 5 2))
"17 1/2"
Setting UNITMODE to 1 causes units to be displayed as entered. This affects the values returned by rtos for engineering, architectural, and fractional formats, as shown in the following examples:
Command: (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"
See Also
The String Conversions topic in the AutoLISP Developer's Guide.
Comments? |
|