半听可乐 发表于 2012-7-19 12:02
你好,我再次试了一下,如图所示,变整数了 - (defun c:rea(/ n times en data dt)
- (setq old_pre (getvar "luprec"));;;加了这句,主要是单位的问题
- (setvar "luprec" 8);;;还有这句
- (princ "\n选择数字:")
- (setq ss (ssget (list (cons 0 "text"))))
- (initget 1)
- (setq dt (getreal "\n输入要加的值:"))
- (if ss
- (progn
- (setq n 0 times (sslength ss))
- (repeat times
- (setq en (ssname ss n) data (entget en) number (read (cdr (assoc 1 data))))
- (if (member (type number) '(INT REAL))
- (progn
- (setq data (subst (cons 1 (rtos (+ number dt)))(assoc 1 data) data))
- (entmod data)
- )
- )
- (setq n (1+ n))
- )
- )
- )
- (setvar "luprec" old_pre)
- (princ)
- )
|