不知道你要干什么,所以没法检验。按我自己的理解处理了一下,代码如下:- (defun c:dggj (/ a e1 e2 stext1 stext)
- (setvar "cmdecho" 0)
- (setq e1 (entget (car(entsel"\n选择欲替换的文字内容"))))
- (setq e2 (entget (car (nentsel "\选择计算值:"))))
- (setq a1 (cdr (assoc 1 e1)))
- (setq a2 (cdr (assoc 1 e2)))
- (setq z1 (atof (substr a2 2 3)))
- (setq z2 (atof (substr a2 6 3)))
- (cond
- ((> z1 15.8) (setq a 12))
- ((> z1 10) (setq a 10))
- ((> z1 5.6) (setq a 8))
- (t (setq a 6))
- )
- (setq b (/ (* pi (* (/ a 2) (/ a 2))) 10))
- (setq c (rtos (/ (* b 20) z2)))
- (setq d (substr c 1 3))
- (setq f (strcat "φ130" (itoa a) "@100/" d))
- (setq e1 (subst (cons 1 f) (assoc 1 e1) e1 ))
- (entmod e1)
- (setvar "cmdecho" 1)
- )
- (prin1)
|