创建一些文字,其中有旧的。
- ;;method by Alanj
- ;;modified by reid b.
- (defun c:test (/ ss id ent a b)
- (setq ss (ssget "_x" '((0 . "text,mtext")))
- id 0)
- (while (setq ent (ssname ss id))
- (if (wcmatch (strcase (cdr (setq a (assoc 1 (setq b (entget ent)))))) "*[color=red]OLD[/color]*")
- [u];;[color=red]OLD[/color] must be uppercase[/u]
- [color=dimgray][color=black][u];;will only modify text with the word [color=red]old[/color] in it[/u][/color]
- [/color] (entmod (subst (cons 1 "[color=red]NEW[/color]") a b))
- )
- (setq id (1+ id))
- )
- (princ)
- )
|