Relative coordinates in a macro
Relative coordinates in a macro
(OP)
I'm tinkering with a macro definition for an AutoCAD button that will create a leader line to be used for a welding symbol. The macro needs to create a leader in MS with the tail being exactly 1" in PS. The sticking point is my logic wants to use a relative coordinate definition that is based upon the DIMSCALE. I have been unable to figure out how to use relative coordinates in a macro without actually prompting for user input.
The only thing that works half-way is this:
^C^C(SETQ LX (GETVAR "DIMSCALE")LY '0);_LEADER;\\;;N;UCS;O;@;LINE;@;(LIST LX LY);;UCS;P;
The problem is, the specification "@" for last point picked (also LASTPOINT value) works correctly when starting in WCS, but if starting in anything other than WCS, the @ point is off in the stratosphere.
I want to believe that if I can use relative coordinates for the last point without stopping the leader command and going to draw a line based on a new UCS that it would work better.
Thoughts?
Thanks in advance!
Bill
Racer24ksi
The only thing that works half-way is this:
^C^C(SETQ LX (GETVAR "DIMSCALE")LY '0);_LEADER;\\;;N;UCS;O;@;LINE;@;(LIST LX LY);;UCS;P;
The problem is, the specification "@" for last point picked (also LASTPOINT value) works correctly when starting in WCS, but if starting in anything other than WCS, the @ point is off in the stratosphere.
I want to believe that if I can use relative coordinates for the last point without stopping the leader command and going to draw a line based on a new UCS that it would work better.
Thoughts?
Thanks in advance!
Bill
Racer24ksi





RE: Relative coordinates in a macro
RE: Relative coordinates in a macro
^C^C_LEADER;\\(polar (getvar "lastpoint") 0 (getvar "dimscale"));;;N;
Note: Because the tail of the leader is supposed to be 1", the DIMSCALE value is equal to 1" in PS.
Bill
Racer24ksi
RE: Relative coordinates in a macro
Take care.
www.homescript.com
RE: Relative coordinates in a macro
BTW - Playing with it a little further, the syntax is actually (polar point1 angle distance) where angle is in radians. To make the leader tail 1" in the opposite direction, replace 0 with pi:
^C^C_LEADER;\\(polar (getvar "lastpoint") pi (getvar "dimscale"));;;N;
For angles other than 0 and 180, math functions worked well too:
^C^C_LEADER;\\(polar (getvar "lastpoint") (/ pi 2) (getvar "dimscale"));;;N;
would produce a tail oriented 90 degrees vertical.
Thanks again for your help.
Bill
Racer24ksi