Frustrating AutoCAD (LT) macros

Discussion in 'AutoCAD' started by Mark Gonzales, Feb 17, 2004.

  1. I sure wish AutoCAD and AutoCAD LT worked the same.

    I have a complex macro I use in LT which uses an attribute to label a line
    (i.e. labeling a pipe "HWS"). It breaks the line (per size of the label),
    sets the proper layers and rotation angle (along line horizontally or
    right-read), and so forth.

    Here is the macro (watch for wrap, LOL!)...

    ============
    ID_LabelLine [La&bel Line]*^C^C_setenv Label \_ucs _ob _nea,_mid \_ai_molc
    _non @ _break _non
    @$M=$(*,$(getvar,textsize),$(+,$(*,$(strlen,$(getenv,label)),.5),.5))<0 _non
    @$(*,$(getvar,textsize),$(+,$(strlen,$(getenv,label)),1))<180 _-insert
    Base/Dwg/Label_2 _non
    @$(*,$(getvar,textsize),$(*,$(+,$(strlen,$(getenv,label)),1),.5))<0
    $(getvar,textsize)
    $(getenv,label);$(if,$(or,$(<,$(index,0,$(getvar,ucsxdir)),0),$(<,$(index,1,
    $(getvar,ucsydir)),0),$(=,$(index,1,$(getvar,ucsxdir)),-1)),_rotate _l _non
    @ 180 )_ucs _r md
    ============

    You have to have an attribute as well as layers and a UCS setup, etc. for it
    to work (all done automatically upon drawing setup), but it does work
    perfectly in regular AutoCAD as long as I remove the first part "_setenv
    Label \" which determines the label value. <sigh>

    Again, when I remove the setenv part, it works fine for me in regular
    AutoCAD. For whatever reason, the regular AutoCAD equivalent...

    "(setenv "Label" (rtos (getdist "Label Value: ")))" - thanks again, Paul
    Turvill

    ....won't work as part of a macro.


    My previous simple example has a similar problem...

    ============
    Works: [Save]^C^C(setenv "Temp1" (getvar "clayer"))
    Doesn't work :[Save]^C^C(setenv "Temp1" (getvar "clayer"))_line
    ============

    Adding anything behind the Setenv LISP function (i.e. _line) causes the
    whole macro not to work.

    Would it possible for me to write a LISP routine to simulate AutoCAD LT's
    SETENV command so that I don't have to change my macros to work in regular
    AutoCAD? Or would this be way too much trouble?
     
    Mark Gonzales, Feb 17, 2004
    #1
  2. Oops. That should have been: (setenv "Label" (getstring "Label Value: ")).
    But it still won't work. <sigh>
     
    Mark Gonzales, Feb 18, 2004
    #2
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.