;批量替换文本值
(defun c:rep()
    (setq s (ssget (list (cons 0  "text"))))
    (setq sl (sslength s))
    (setq str (getstring "替换为:"))
    (setq st 0)
    (while (< st sl)
        (setq e (entget (ssname s st)))
        (setq st(1+ st))
        (setq src (cdr (assoc 1 e)))
        (setq e (subst (cons 1 str) (assoc 1 e) e))
        (entmod e)
        (princ (strcat src "替换为" str "\n"))
    )
    (princ (strcat "已替换" (itoa st) "项\n"))
    (setq ret nil)
)