Hello again,
I'm trying to update old drawings and details to our new standards. I was trying to find a way to change all the test and mtext from our old text styles to our new text styles. I have a lisp that will change all the text and mtext that is not in a block. I'm stuck on the one for the text that is embedded in a block though. Below is what I've been working on. I've been stuck for a while now and was hoping someone may be able to see my problem. I'm still pretty new to this.
Thanks,
Mike
Code:
(defun chblk ()
(setq objs (ssget "x" '((0 . "INSERT")))
in 0
)
(repeat (sslength objs)
(setq ent (ssname objs in)
lst (entget ent)
)
(if (= (cdr (assoc 0 lst)) "INSERT")
(progn
(setq ename (cdr (assoc -1 lst)))
(while (setq ename (entnext ename))
(if (or (= (cdr (assoc 0 (entget ename))) "TEXT")
(= (cdr (assoc 0 (entget ename))) "MTEXT")
) ;or
(progn
(setq lst (entget ename)
name (cdr (assoc 7 lst))
)
(cond
((null name))
((= name "Std Text")
(setq lst (subst (cons 7 "FORMAT1") (assoc 7 lst) lst))
(entmod lst)
(entupd (cdr (assoc -1 lst)))
(setq n (+ 1 n))
)
((= name "SS")
(setq lst (subst (cons 7 "FORMAT1") (assoc 7 lst) lst))
(entmod lst)
(entupd (cdr (assoc -1 lst)))
(setq n (+ 1 n))
)
((= name "S")
(setq lst (subst (cons 7 "FORMAT1") (assoc 7 lst) lst))
(entmod lst)
(entupd (cdr (assoc -1 lst)))
(setq n (+ 1 n))
)
((= name "STADARD")
(setq lst (subst (cons 7 "FORMAT1") (assoc 7 lst) lst))
(entmod lst)
(entupd (cdr (assoc -1 lst)))
(setq n (+ 1 n))
)
((= name "D")
(setq lst (subst (cons 7 "FORMAT2") (assoc 7 lst) lst))
(entmod lst)
(entupd (cdr (assoc -1 lst)))
(setq n (+ 1 n))
)
((= name "T")
(setq lst (subst (cons 7 "FORMAT2") (assoc 7 lst) lst))
(entmod lst)
(entupd (cdr (assoc -1 lst)))
(setq n (+ 1 n))
)
) ;cond
)
)
) ; if
) ; while
(setq in (1+ in))
)
)
(alert (strcat (itoa n) " Items Changed "))
)