Simplify?

Discussion in 'AutoCAD' started by G Cooper, Jun 3, 2004.

  1. G Cooper

    G Cooper Guest

    Perhaps someone here can shed some light on this for me. I'm not great at
    lsp (old-school I know :)), but I can follow along...
    Our office uses a custom mnu file for drawing files. Basically it automates
    most of the repetitive operations, except one. In order for the block and
    text scales to insert properly at plan scale we have this:

    [1:1000 ](setq scale 1.00)(setvar "LTSCALE" scale)(setvar
    "USERR1" scale);limits;off;-UNITS;2;2;2;4;90;Y;-UNITS;;;;;270;;GRAPHSCR

    - and there are a number other common scale choices. This is used to scale
    the blocks on insert as well as to set text height as such:

    [ Leroy 80 ](setq textscale (* scale
    2.0));-STYLE;LEROY80;ROMANS;!textscale;1;0;;;;

    - and there are a number of text styles...

    It all works pretty well, until you have to change scales (for Details and
    Layouts), in which you have to reset the text height for each text style you
    are using.

    What would be great is if after setting the scale it would automatically
    update all the text style heights with one click of the mouse. If it set all
    the text styles it wouldn't be a problem as the unused ones would simply be
    purged out later. If someone could point me in the right direction for this
    operation that would be great.
     
    G Cooper, Jun 3, 2004
    #1
  2. Consider defining the text styles with zero height, so that it will ask for
    the height each time you use them. Then in the menu item by which you
    invoke the use of the text, have it feed in the height (as a multiplier of
    the current LTSCALE or DIMSCALE or something) in the appropriate place in
    the prompt sequence. Then you don't ever have to redefine the text style.

    Kent Cooper, AIA


    ...
     
    Kent Cooper, AIA, Jun 3, 2004
    #2
  3. G Cooper

    T.Willey Guest

    You could use the "tblnext" function to search for all the styles. Then set the default text height one by one until you get them all.

    Tim
     
    T.Willey, Jun 3, 2004
    #3
  4. G Cooper

    RichardG Guest

    my guess is you like to have predefined text heights and so kent's advice
    might not be acceptable
    So another approach might be to create your text styles with the name
    containing the scale of the main scale you will use.
    (sorry sounds confusing) ie "1000-Leroy 80" for example would be for you
    main working scale. And other layouts having other scales would use a text
    style of 200-Leroy 80 (if we assume a new layout scale might be at 1"=200').
    Or insted for details you could add something like "Det40-Leroy 80" for a
    detail text style drawn at 40' scale.
     
    RichardG, Jun 3, 2004
    #4
  5. G Cooper

    G Cooper Guest

    containing the scale of the main scale you will use.<

    No doubt a good way to keep track of the details and their scales. In
    addition to my first post, there is a custom dimensioning routine that
    relies on the current textstyle and is fully automated, so a prompt for the
    text height in every instance would drive anyone nuts. What I'm looking for
    is a way to: 1. Set scale (for details or main), 2. Have the text styles
    update automatically according to the scale selected. Maybe a subroutine
    appended to the scale routine? Perhaps "tblnext" as Tim mentioned, that can
    be automated right?

    Greg
     
    G Cooper, Jun 4, 2004
    #5
  6. G Cooper

    Rick Keller Guest

    I only use 1 text height but I have many scales in my drawings so to switch
    between the scales I use a pulldown menu that switches my dimstyle & text
    height etc.. here is a line from my menu to switch to 1/2" : ft.

    [24 1/2"=1']^C^C-DIMSTYLE;;24;-STYLE;standard;;2.25;;;;;LTSCALE;9

    You could add more text style switches for your different heights & styles.

    Rick
     
    Rick Keller, Jun 4, 2004
    #6
  7. G Cooper

    Dick Coy Guest

    You could redefine the scale command to update the dimlfac of the dimensions
    by the scale factor (dimlfac would go down as the scale goes up)
     
    Dick Coy, Jun 4, 2004
    #7
  8. G Cooper

    Warren Trost Guest

    LTSCALE has no relation to text heights or DIMSCALE as it is set to how one
    likes the linetypes to display. Some like LTSCALE to equal one, some like
    0.5, some like 1/3, etc. so if the LTSCALE was changed it would change your
    heights etc. Why not use the DIMSCALE which is set up on the plot scale no
    matter what the LTSCALE factor is?


    heights for L80, L100, & L120 at 1:1 scale. In this case, they are hard
    coded to 0.08, 0.10 & 0.12 respectively. This allows for a multiplication
    factor with respect to the new ltscale. I'm working as an engineer, so I
    will use an example as it applies to decimal feet.
    achieve the following style changes:
    you may ever have and their 1:1 text heights, you will be able to apply the
    LTSCALE as a scaling factor and achieve your new style heights.
     
    Warren Trost, Jun 4, 2004
    #8
  9. G Cooper

    T.Willey Guest

    (defun c:TextDefaultHeight ()

    (setq dh1 0.125); whatever you text height is when plotting 1:1
    (setq tsf1 (getvar "dimscale")); text scale factor
    (setq nh1 (* dh1 tsf1)); get new height for text
    (setq tbl1 T); used to search style table

    (while (setq tb2 (tblnext "style" tbl1))
    (setq to1 (entget (tblobjname "style" (cdr (assoc 2 tb2)))))
    (setq to2 (subst (cons 40 nh1) (assoc 40 to1) to1))
    (entmod to2)
    (if tbl1
    (setq tbl1 nil)
    )
    )

    (princ)

    )

    Here is something quick. It changes all the style default height per the dimscale. If you use another factor then just substitute that in where the text scale factor is.

    Maybe someone can tell us how to hook this up to a reactor, so that whenever the dimscale changes the program will run automatically.

    Hope it helps,

    Tim
     
    T.Willey, Jun 4, 2004
    #9
  10. G Cooper

    G Cooper Guest

    Andrew,

    With a couple of changes (ft to m) it works very well. I should have no
    trouble adding it into our lsp routines. I really like the way it's so
    unobtrusive on the command line, very neat and clean. This will allow me to
    make a few more tweeks and clean ups of our custom lsp, I can now have the
    styles defined in the template and add a simpler style change using
    "textstyle" instead of all that gobbly gook there is now. I'll have to keep
    the old code around the mnu file, but I think I will almalgamate it all into
    one menu item in cases where the template is not used.

    Greg

    heights for L80, L100, & L120 at 1:1 scale. In this case, they are hard
    coded to 0.08, 0.10 & 0.12 respectively. This allows for a multiplication
    factor with respect to the new ltscale. I'm working as an engineer, so I
    will use an example as it applies to decimal feet.
    achieve the following style changes:
    you may ever have and their 1:1 text heights, you will be able to apply the
    LTSCALE as a scaling factor and achieve your new style heights.
     
    G Cooper, Jun 4, 2004
    #10
  11. G Cooper

    G Cooper Guest

    Now all I need is a cool little toolbox that shows the current scale and
    test style.... Hmm

    Thanks for your help!

    Greg

    heights for L80, L100, & L120 at 1:1 scale. In this case, they are hard
    coded to 0.08, 0.10 & 0.12 respectively. This allows for a multiplication
    factor with respect to the new ltscale. I'm working as an engineer, so I
    will use an example as it applies to decimal feet.
    achieve the following style changes:
    you may ever have and their 1:1 text heights, you will be able to apply the
    LTSCALE as a scaling factor and achieve your new style heights.
     
    G Cooper, Jun 4, 2004
    #11
  12. G Cooper

    andywatson Guest

    Greg,
    I'm glad it worked for you. As previosly stated, you may want to alter where the program gets its current scale factor. Relying on LTSCALE is a bad habit I've gotten into with our company standards.

    As far as a toolbox for current scale and text style, I haven't had much experience with creating toolbars, but I agree and wonder why they haven't made the Text toolbar like the Dimension toobar, where you can not only see your current style, but select the desired one from a combo box.

    (setvar "MODEMACRO" "TextStyle: $(getvar,textstyle) | Scale:
    $(getvar,ltscale)")

    The above code will show your current text style and the value of LTSCALE in the lower left corner of AutoCAD. Maybe you can settle with that.

    Andrew
     
    andywatson, Jun 4, 2004
    #12
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.