- (defun c:tt (/ e1 e2 n n1 n2 s str1)
- (while
- (progn
- (princ "\n选择源文字:")
- (and
- (setq e1 (ssget ":S" '((0 . "*text"))))
- (progn
- (setq e1 (ssname e1 0))
- (redraw e1 3)
- (setq str1 (cdr (assoc 1 (entget e1))))
- (setq n1 (VL-STRING-SEARCH "[" str1)
- n2 (VL-STRING-SEARCH "]" str1)
- )
- (and n1 n2 (> n2 n1))
- )
- )
- )
- (setq str1 (substr str1 (+ 2 n1) (- n2 n1 1)))
- (while (setq s (ssget ":S" '((0 . "*text"))))
- (repeat (setq n (sslength s))
- (setq e2 (entget (ssname s (setq n (1- n)))))
- (entmod (subst (cons 1 str1) (assoc 1 e2) e2))
- )
- (princ "\n继续选择替换文字,回车结束:")
- )
- (redraw e1 4)
- )
- (if e1 (redraw e1 4))
- (princ)
- )
|