拿楼主的代码修改了一下。借花献佛。供大家参考。

- (defun c:11 ( / ss ss1 ent old_thight new_thight elist i e)
- (setq ss (ssget ":S" '((0 . "MTEXT,TEXT,MULTILEADER"))))
- (setq ent (cdr(assoc 0 (entget (ssname ss 0) ))))
- (if (= ent "MULTILEADER")
- (setq old_thight (rtos (cdr(assoc 41 (entget (ssname ss 0) )))))
- (setq old_thight (rtos (cdr(assoc 40 (entget (ssname ss 0) )))))
- )
- (setq new_thight (getstring (strcat "\n请输入字符新高:" "<当前字高" old_thight ">")))
- (if (= new_thight "") (setq new_thight old_thight))
- (setq i (sslength ss))
- (while
- (setq e (ssname ss (setq i (1- i))))
- (setq ss1 (cdr (assoc 0 (entget e))))
- (setq elist (entget e))
- (cond
- ((member ss1 '("TEXT" "MTEXT"))(entmod (subst (cons 40 (atof new_thight)) (assoc 40 elist) elist)))
- ((member ss1 '("MULTILEADER")) (entmod (subst (cons 41 (atof new_thight)) (assoc 41 elist) elist)) )
- )
- )
- (princ (strcat "\n*** 已将 " (rtos (sslength ss)) " 个字符的高度替换为" new_thight " ***" ))
- (princ))
|