Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Default text size in template

6 REPLIES 6
Reply
Message 1 of 7
pquinlisk
537 Views, 6 Replies

Default text size in template

What would be the best way to set the default text size and style within a single template. Example: I want to create templates for various architectural scales for use in creating detail sheets. One template for 1/8, another for 1/4 another for 1-1/2... Help?
6 REPLIES 6
Message 2 of 7
Anonymous
in reply to: pquinlisk

A lot of people use the "dimscale" System Variable for that. We like to
keep that independent and actually related to dimensioning, in case we need
to vary it in relation to the drawing scale, so we use the "useri1" System
Variable, set to the ratio between the real world and the drawing (96 for
1/8" scale, 8 for 1-1/2" scale, etc.), which is usually the same as the
"dimscale" value.

Either way, you can make a setup routine (ours is on the Screen Menu, but it
could be anywhere), in which you can select the scale and set "dimscale" or
"useri1" or whatever you choose to use. Then have a menu item that
establishes the text size and style, using the Style command, which leaves
the default style as whatever style you just created.

We have an item on the "base" Screen Menu that calls up this sub-menu, but
the same kind of content could be on a pull-down, or other places:

**SETUP 3
[ SCALE ?]
[FULLSIZE]^C^C(setvar "USERI1" 1) $S=SU
[HALFSIZE]^C^C(setvar "USERI1" 2) $S=SU
[3"]^C^C(setvar "USERI1" 4) $S=SU
[1-1/2"]^C^C(setvar "USERI1" 😎 $S=SU
[1"]^C^C(setvar "USERI1" 12) $S=SU
[3/4"]^C^C(setvar "USERI1" 16) $S=SU
[1/2"]^C^C(setvar "USERI1" 24) $S=SU
[3/8"]^C^C(setvar "USERI1" 32) $S=SU
[1/4"]^C^C(setvar "USERI1" 48) $S=SU
....etc....

Then the SU sub-menu called up by those lines includes a "Done" thing after
all other setup options (like sheet size) have been picked, which does
various things, including this:

[**DONE!**].......+
-STYLE NOTEBIG ROMANS.SHX;(* (getvar "USERI1") 0.125) 1 ;;;;+
-STYLE NOTESTD ROMANS.SHX;(* (getvar "USERI1") 0.078125) 1 ;;;;+
(setvar "DIMSCALE" (getvar "USERI1")) +
......

That leaves the last Style defined (in our case, 'NOTESTD') as the default,
with a fixed height as a multiple of the scale factor, so it would come out
the same size on paper for any scale chosen above.

You might have to change the ;;;; part, depending on the font you use (.TTF
ones won't have the vertical option, for instance).

If you choose to use "dimscale" instead of "useri1", just substitute
throughout, and leave off the last line that sets it.
--
Kent Cooper


wrote...
What would be the best way to set the default text size and style within a
single template. Example: I want to create templates for various
architectural scales for use in creating detail sheets. One template for
1/8, another for 1/4 another for 1-1/2... Help?
Message 3 of 7
pquinlisk
in reply to: pquinlisk

I can see how that would work out. More specifically I was thinking of creating a template (.dwt) with the text size and font along with the dimscale information directly associated with the scale of choice.

For example, if I start a drawing from scratch and go to Dimension Style, under the Fit tab and Scale for Dimension Features, I can select Use Overall Scale Of... and input the desired scale factor (example - 96). Additionally I can set the default text size under the Text tab and set the text height to 3/32" for example. This gets me a dimension text size of 9" on a 1/8" scale drawing.

Can the text style information be handled in a similar fashion?
Message 4 of 7
Anonymous
in reply to: pquinlisk

I was thinking that you make a menu item (or items) somehow, to create those
things, which you mostly only need to use within a drawing that you're going
to save as a template. Then any drawing based on that scale-specific
template will have it all set to go. But you could also use the same menu
item(s) to set them up in a drawing that isn't based on the template, as
long as the general scale factor is set, either using "dimscale" or a
"useri#" variable. Whichever one would need to be entered by the user,
either picked off a list as in my earlier example, or asked for as in yours.
One advantage of picking it off a list in a screen or pull-down menu is that
there's no chance of an error such as entering 95 instead of 96.

You can set up text styles using that information by various methods (lisp,
macro, whatever), and just when the text height is asked for, do (in your
size example):

(* (/ 3.0 32) (getvar "dimscale"))

and it will size it appropriately. [Make sure you make one of the numbers a
real (with a decimal) rather than an integer, because dividing an integer by
an integer will give you an integer result (zero in this case). Or you can
avoid that problem by doing

(* 0.09375 (getvar "dimscale"))

if you prefer.]

If by "text style information" you mean font, you can also have them pick
that off a list if you want to limit the options. And if you want to make
more than one style based on the same font (as my earlier example does with
two fixed sizes), you can save that, too:

(setq textfont (getstring "Text font for making typical Styles: "))

or have the menu list item set that variable. Then feed in 'textfont' at
the point in the Style command(s) where it asks for that:

(command "style" "typ3-32nds" textfont (* 0.09375 (getvar "dimscale")) "" ""
"" "")
or in macro format, something like
-Style typ3-32nds !textfont (* 0.09375 (getvar "dimscale")) ;;;;

with the ending parts dependent on the kind of font file -- how many enters
if you want all defaults at the end, or otherwise variable as you prefer, if
you don't. That way they can give it one font name and it can be used to
make multiple text styles. An advantage of picking the font off a list is
that you can limit it to those that will have the same number of prompts at
the end (AutoCAD .SHX fonts will have the vertical option), or you can have
the Style command use a different number of prompts for .TTF or some
non-ACAD .SHX fonts by including something about that in what the menu
selection returns.

--
Kent Cooper


wrote...
I can see how that would work out. More specifically I was thinking of
creating a template (.dwt) with the text size and font along with the
dimscale information directly associated with the scale of choice.

For example, if I start a drawing from scratch and go to Dimension Style,
under the Fit tab and Scale for Dimension Features, I can select Use Overall
Scale Of... and input the desired scale factor (example - 96).
Additionally I can set the default text size under the Text tab and set the
text height to 3/32" for example. This gets me a dimension text size of 9"
on a 1/8" scale drawing.

Can the text style information be handled in a similar fashion?
Message 5 of 7
brockh
in reply to: pquinlisk

I created several drawings that are empty except for text styles and dimension styles and arrow blocks for dimensions. In our lisp file I have it load these into our drawings when a user types our company name and scale they want. I also insert layers like this. Its the best way for getting dimension because it brings in the child styles as well.
Its simple easy and everyone can remember. We also do our layers like this. I then add a help file in the lisp also so by typing ghnhelp they can read about all the lisp commands and such. My plan was to make it easier for the users than setting up there own stuff.
here is an example.

;--------------------------------
(defun
c:GHN500 ()
(setvar "cmdecho" 0)
(command "-insert" "GHN-500-SC.dwg" (list 0 0) "" "" "")
(alert "GHN500, Dim & Text Styles Loaded successfully")
(setvar "cmdecho" 1)
(princ))
;_ end of defun
(princ)
(princ)
;--------------------------------
(defun
c:GHNLAY ()
(setvar "cmdecho" 0)
(command "-insert" "GHN-LAYERS.dwg" (list 0 0) "" "" "")
(alert "GHN Layers Loaded successfully")
(setvar "cmdecho" 1)
(princ))
;_ end of defun
(princ)
Message 6 of 7
brockh
in reply to: pquinlisk

I use templates only for page setups again attempting to make it easier. That way the users dont have to mess with plot settings. Its there so they grab it cause its easier. Let me know what you guys think of this.
Message 7 of 7
pquinlisk
in reply to: pquinlisk

These are both excellent methods. This is so much more than I expected. My end goal is to automate the creation of new drawings and sheet drawings. The user would start a drawing from scratch.

The menu is the first response could be used by all users with some adjustment... If I am reading it correctly. It would just need the templates ready to go.

Thanks for your help.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost