Jump to content

Add or Refine Text Style on Every start or AutoCAD (being style on AutoCAD forever)


mr_bin47

Recommended Posts

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

Screenshot 2022-07-06 032739.png

Link to comment
Share on other sites

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 by mhupp
  • Like 3
Link to comment
Share on other sites

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 ? 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

image.png.896c1d82b093867aa446c29c3e2b531c.png

  • Like 2
Link to comment
Share on other sites

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

image.png.896c1d82b093867aa446c29c3e2b531c.png

 

that's a good way ,

thank you sir 🙏

Link to comment
Share on other sites

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"))

 

  • Like 1
Link to comment
Share on other sites

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 ?

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...