(defun c:Test (/ ss sn p st efind replase)
;; Tharwat 29.9.2015 ;;
(setq find (getstring "Find "))
(setq replace (getstring "Replase "))
(if (setq ss (ssget "_:L" '((0 . "TEXT")(1 . *find*))))
(while (setq sn (ssname ss 0))
(if (setq p (vl-string-search exist (setq st (cdr (assoc 1 (setq e (entget sn)))))))
(entmod (subst (cons 1 (strcat (substr st 1 p) replace (substr st (+ 3 p)))) (assoc 1 e) e))
)
(ssdel sn ss)
)
)
(princ)
)
查看更改:
(defun c:test (/ ss sn st e find replace)
;; Tharwat 29.9.2015 ;;
(if (and (/= "" (setq find (getstring "\nFind :")))
(/= "" (setq replace (getstring "\nReplace :")))
(setq
ss (ssget "_:L"
(list '(0 . "TEXT") (cons 1 (strcat "*" find "*")))
)
)
)
(while (setq sn (ssname ss 0))
(setq e(entget sn)
st (cdr (assoc 1 e))
)
(entmod (subst (cons 1 (vl-string-subst replace find st))
(assoc 1 e)
e
)
)
(ssdel sn ss)
)
)
(princ)
) 谢谢。
不客气。
页:
1
[2]