mr_bin47 Posted July 6, 2022 Share Posted July 6, 2022 hi friends, I'm using autocad with just many fonts, these fonts are very popular fonts on company so for every file i should to Refine these Text Style, is there any way with lisp program that i place on autocad to know these Text Style for every time and can be use on every file ? Special thanks Hamid Quote Link to comment Share on other sites More sharing options...
mhupp Posted July 6, 2022 Share Posted July 6, 2022 (edited) This matches above. yes is for the backwards being checked. change to "" if not needed to be backwards (vl-cmdf "_.Style" "Kateb NaskhD" "naskhd" "" "" "" "Yes" "" "") Add to a lisp that is in your startup suite at is loaded on load. Edited July 6, 2022 by mhupp 3 Quote Link to comment Share on other sites More sharing options...
mr_bin47 Posted July 6, 2022 Author Share Posted July 6, 2022 20 minutes ago, mhupp said: This matches above. yes is for the backwards being checked. change to "" if not needed to be backwards (vl-cmdf "_.Style" "Kateb NaskhD" "naskhd" "" "" "" "Yes" "" "") Add to a lisp that is in your startup suite at is loaded on load. thank you sir, as i'm new to this, can you help me to what to do with this LISP, copy and paste on which file ? Quote Link to comment Share on other sites More sharing options...
mhupp Posted July 6, 2022 Share Posted July 6, 2022 Type appload this should pop up load style.lsp into the startup suit. contains above code. style.lsp 2 Quote Link to comment Share on other sites More sharing options...
mr_bin47 Posted July 6, 2022 Author Share Posted July 6, 2022 thank you for you description, one of my friends write a LISP for this solution, this lisp start when you press the "K" on keyboard and it create a text style name "Kateb NaskhD" with "naskhd.shx" font, he said i should copy all of text under text of "acad201*doc.lsp" on support folder and just when you press the "K" button it will be start and run. at the end of my explanation, what should i write on this text for creating one more text style, i want a text style "Kateb NaskhC" with run of running this program. kateb_source.txt NASKHD.SHX Quote Link to comment Share on other sites More sharing options...
BIGAL Posted July 6, 2022 Share Posted July 6, 2022 The best way is to use a template drawing a DWT. You have a blank dwg with all your text styles, dimension styles, blocks, layers and more all preset then save as a dwt. You can set every time you start cad your dwt is the default, same if you type NEW. Just type Option 2 Quote Link to comment Share on other sites More sharing options...
mr_bin47 Posted July 7, 2022 Author Share Posted July 7, 2022 8 hours ago, BIGAL said: The best way is to use a template drawing a DWT. You have a blank dwg with all your text styles, dimension styles, blocks, layers and more all preset then save as a dwt. You can set every time you start cad your dwt is the default, same if you type NEW. Just type Option that's a good way , thank you sir Quote Link to comment Share on other sites More sharing options...
tombu Posted July 7, 2022 Share Posted July 7, 2022 As many of the drawings I work on are from others I don't always add my preferred Text Styles and added a drop-down to a ribbon panel to pick Text Styles to add to the current drawing if they're not already in the drawing for when they're needed. Code attached with a few macro examples at the bottom. ; Add New Text Style by Tom Beauford (defun NewStyle (TxtStyle Font / acadApp acadDoc styles objStyle FType) (setq acadApp (vlax-get-Acad-object) acadDoc (vla-get-ActiveDocument acadApp) styles (vla-get-textstyles acadDoc) objStyle (vla-add styles TxtStyle) FType (vl-filename-extension Font) ) (if(= ".ttf" FType)(setq Font (strcat "C:\\Windows\\Fonts\\" Font))) (setq Font (findfile Font)) (princ "\nFont = ")(princ Font)(princ) (vla-put-fontfile objStyle Font) (setvar 'textstyle TxtStyle) (princ) ) ;^C^C^P(or NewStyle (load "NewStyle.lsp"))(or(tblsearch "style" "Romans")(NewStyle "Romans" "romans.shx")) ;^C^C^P(or NewStyle (load "NewStyle.lsp"))(or(tblsearch "style" "Simplex")(NewStyle "Simplex" "simplex.shx")) ;^C^C^P(or NewStyle (load "NewStyle.lsp"))(or(tblsearch "style" "Arial")(NewStyle "Arial" "arial.ttf")) ;^C^C^P(or NewStyle (load "NewStyle.lsp"))(or(tblsearch "style" "Arial Bold")(NewStyle "Arial Bold" "arialbd.ttf")) ;^C^C^P(or NewStyle (load "NewStyle.lsp"))(or(tblsearch "style" "Arial Narrow")(NewStyle "Arial Narrow" "arialn.ttf")) ;^C^C^P(or NewStyle (load "NewStyle.lsp"))(tblsearch "style" "Swiss Lt BT")(NewStyle "Swiss Lt BT" "swissl.ttf")) 1 Quote Link to comment Share on other sites More sharing options...
mr_bin47 Posted July 7, 2022 Author Share Posted July 7, 2022 52 minutes ago, tombu said: As many of the drawings I work on are from others I don't always add my preferred Text Styles and added a drop-down to a ribbon panel to pick Text Styles to add to the current drawing if they're not already in the drawing for when they're needed. Code attached with a few macro examples at the bottom. ; Add New Text Style by Tom Beauford (defun NewStyle (TxtStyle Font / acadApp acadDoc styles objStyle FType) (setq acadApp (vlax-get-Acad-object) acadDoc (vla-get-ActiveDocument acadApp) styles (vla-get-textstyles acadDoc) objStyle (vla-add styles TxtStyle) FType (vl-filename-extension Font) ) (if(= ".ttf" FType)(setq Font (strcat "C:\\Windows\\Fonts\\" Font))) (setq Font (findfile Font)) (princ "\nFont = ")(princ Font)(princ) (vla-put-fontfile objStyle Font) (setvar 'textstyle TxtStyle) (princ) ) ;^C^C^P(or NewStyle (load "NewStyle.lsp"))(or(tblsearch "style" "Romans")(NewStyle "Romans" "romans.shx")) ;^C^C^P(or NewStyle (load "NewStyle.lsp"))(or(tblsearch "style" "Simplex")(NewStyle "Simplex" "simplex.shx")) ;^C^C^P(or NewStyle (load "NewStyle.lsp"))(or(tblsearch "style" "Arial")(NewStyle "Arial" "arial.ttf")) ;^C^C^P(or NewStyle (load "NewStyle.lsp"))(or(tblsearch "style" "Arial Bold")(NewStyle "Arial Bold" "arialbd.ttf")) ;^C^C^P(or NewStyle (load "NewStyle.lsp"))(or(tblsearch "style" "Arial Narrow")(NewStyle "Arial Narrow" "arialn.ttf")) ;^C^C^P(or NewStyle (load "NewStyle.lsp"))(tblsearch "style" "Swiss Lt BT")(NewStyle "Swiss Lt BT" "swissl.ttf")) very great and thank you, as i understand this code will add Text Style? so can u explain a little that how can i edit this for my fonts ? Quote Link to comment Share on other sites More sharing options...
tombu Posted July 7, 2022 Share Posted July 7, 2022 Macro like mhupp offered would probably be best for you. There doesn't seem to be a way to do Backwards with visual lisp. (Never seen text Backwards before!) It could be done with entmake using DXF codes 2 = Text is backward for Group code for Style in Tables section with plain lisp. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.