Changing all Text styles to another text style
Not applicable
03-11-2020
10:33 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
Can anybody help me with the below code; I'd like to modify this code so that i can create a new text style with Arial Font and then change all text styles in a drawing to that style. Also is there a way that i can put an icon on the toolbar to have this lisp runs every time i push it?
(defun ChangeStyle (strStyle1 strStyle2 / entItem objBlock objDocument objItem )
(vl-load-com)
(setq objDocument (vla-get-activedocument (vlax-get-acad-object)))
(if (and (tblobjname "style" strStyle1)
(tblobjname "style" strStyle2)
)
(vlax-for objBlock (vla-get-blocks objDocument)
(if (> (vla-get-count objBlock) 0)
(progn
(setq objItem (vla-item objBlock 0)
entItem (vlax-vla-object->ename objItem)
)
(while entItem
(if (and (vlax-property-available-p (setq objItem (vlax-ename->vla-object entItem)) "StyleName")
(= (strcase (vla-get-stylename objItem)) (strcase strStyle1))
)
(vla-put-stylename objItem strStyle2)
)
(setq entItem (entnext entItem))
)
)
)
)
(princ "\nError check if styles exist: ")
)
(vla-regen objDocument 0)
)
Thanks for your help!
Link copied