PDA

View Full Version : Using ALIGN in LISP routine


j_r_sorenson
2009-04-02, 06:16 PM
Bits and pieces of my code:

(setq point1A (getpoint "Specify first source point:"))
(setq point1B (getpoint "Specify first destination point:"))
(setq point2A (getpoint "Specify second source point:"))
(setq point2B (getpoint "Specify second destination point:"))

(setq newobj (entlast))

(command "ALIGN" newobj "" point1A point1B point2A point2B "" N)

....the Align command just will not work for me.

I have verified that I am getting points for 1A, 1B, 2A, & 2B, and that newobj is set to the right object(s).

I have tried a number of small changes; looking for any suggestions.

Thanks.

j_r_sorenson
2009-04-02, 08:33 PM
Solved! Added quotes around the "N", and it works perfectly.

hofcad
2009-04-03, 12:27 PM
Solved! Added quotes around the "N", and it works perfectly.

You can also see 'The Externally Defined Commands' in de AutoCAD Help
(HELP->AutoLISP Reference->Externally Defined Commands->aligncommands: ALIGN).
(setq s1 (getpoint "Specify first source point:"))
(setq d1 (getpoint "Specify first destination point:"))
(setq s2 (getpoint "Specify second source point:"))
(setq d2 (getpoint "Specify second destination point:"))
(setq ss (ssget))
(align ss s1 d1 s2 d2 "" "2d")

Regards, HofCAD CSI.

j_r_sorenson
2009-04-03, 05:23 PM
I'm glad you brought that up, because it gives me an opportunity to ask -

I actually was using that method to invoke the Align command, and it would work in my current session. However, in subsequent sessions, it failed (in VLIDE, it wouldn't even "look" like a command).

Can you provide a clue as to what I should try?