选择一个原广西,然后选择你所要修改的文本,这样所有你选择的文本将会与你{dy}次选择的文本的内容一样。
(defun c:thwb()
(setar “cmdecho”0)
(command “undo” “group”)
(princ”n选择替换内容:”)
(setq c1 (single_select ‘((0 . “TEXT”)) T))
(if c1
(redraw c1 3)
)
(setq text1 (cdr (assoc 1 (entget c1))))
(setq number1 (entget c1))
(setq text1 (cons 1 text1))
(princ “n请选择要替换的文本:”)
(setq a (ssget ‘((0 . “TEXT”))))
(setq n (sslength a))
(setq number 0)
(repeat n
(setq a1 (ssname a number))
(setq a11 (entget a1))
(setq number1 a11)
(setq a11 (cdr (assoc 1 a11)))
(setq text11 (subst text1 (assoc 1 number1) number1))
(entmod text11)
(setq number (1+ number))
)
(redraw c1 4)
(command “undo” “end”)
(setar”cmdecho”1)
(princ)
)
标签: , ,