Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations GregLocock on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Relative coordinates in a macro 1

Status
Not open for further replies.

Racer24ksi

Structural
Feb 18, 2002
11
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
 
Replies continue below

Recommended for you

In lisp, I use (polar point1 distance angle) to gt to the next point.
 
Thanks for the tip - that worked out perfect on the first attempt:

^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
 
Whaw. You made the tip into something real cute. To include those two getvars is ingenious. I would have to go more roundabout to get there. You produced the most compact code I have seen since a long time.

Take care.

 
Well, even a blind squirrel finds a nut now and then!

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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor