Good Morning Everyone,
Below I've posted a great routine by Jeff Mishler that converts all text in a file to "Standard". I've used it many times and it works great but I do have a question regarding how it might be modified to convert All text EXCEPT for Helv.
My thinking is to add a not equal to paren grouping to the Wcmatch "TEXT" line, but have yet to get it to successfully work.
Any help in the right direction would be much appreciated.
Thanks
Coyote
;;Change all text, mtext, dimension text, attribute text to the
;;"STANDARD" text style. Preserves all existing text heights &
;;obliquing angles.
;; by Jeff Mishler
(defun c:txt2std (/ styl ss ent count doc blks lokt)
(vl-load-com)
(vla-startundomark (setq doc (vla-get-activedocument
(vlax-get-acad-object)
)))
(vlax-for lay (vla-get-layers doc)
(if (= (vla-get-lock lay) :vlax-true)
(progn
(setq lokt (cons lay lokt))
(vla-put-lock lay :vlax-false)
)
)
)
(if (not (tblsearch "style" "STANDARD"))
(progn
(setq styl (vla-add
(vla-get-textstyles doc)
"STANDARD")
)
(vla-put-fontfile styl "txt.shx")
)
)
(if (setq ss (ssget "x" '((0 . "*TEXT,*DIM*,INSERT"))))
(progn
(setq count -1)
(while (< (setq count (1+ count)) (sslength ss))
(setq ent (vlax-ename->vla-object (ssname ss count)))
(cond ((wcmatch (strcase (vla-get-objectname ent)) "*TEXT*")
(vla-put-stylename ent "STANDARD"))
((wcmatch (strcase (vla-get-objectname ent)) "*BLOCK*")
(progn
(if (= (vla-get-hasattributes ent) :vlax-true)
(progn
(setq atts (vlax-safearray->list
(vlax-variant-value
(vla-getattributes ent))))
(foreach x atts
(vla-put-stylename x "STANDARD")
)
)
)
)
)
(t (vla-put-textstyle ent "STANDARD"))
)
)
)
)
(if (< 0 (vla-get-count (setq blks (vla-get-blocks doc))))
(progn
(vlax-for blk blks
(vlax-for ent blk
(if (vlax-property-available-p ent 'stylename)
(vla-put-stylename ent "STANDARD")
)
)
)
)
)
(if lokt
(progn
(foreach lay lokt
(vla-put-lock lay :vlax-true)
)
)
)
(vla-endundomark doc)
(princ)
)