@dbhunia wrote:
@john.uhden and @Kent1Cooper my 1st thought was like both of you. which will change "Font" of all "Text Style" of the Drawing.
But what if, some one wants to changes only those "Font" of the "Text Style" which have been used in the Drawing?
You could also simplify this a bit if you have a textsyle already setup named "arial".
(defun c:foo nil
(vlax-for a (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object)))
(vlax-for b a
(if (vlax-property-available-p b 'stylename)
(vl-catch-all-apply 'vla-put-stylename (list b "Arial"))
)
)
)
(princ)
)
Like Kent mentioned though this will not fix hardcoded mtext and blocks with attributes will most likely have to be synced.
Or something like this to create the font 'ArialFixed'.
(defun c:foo (/ ad)
(setq ad (vla-get-activedocument (vlax-get-acad-object)))
(vla-put-fontfile a (vla-add (vla-get-textstyles ad) "ArialFixed") "arial.ttf")
(vlax-for a (vla-get-blocks ad)
(vlax-for b a
(if (vlax-property-available-p b 'stylename)
(vl-catch-all-apply 'vla-put-stylename (list b "ArialFixed"))
)
)
)
(princ)
)
(vl-load-com)