Adesu said:
Can some body help me,to solve this my program in autocad,how to stop cursor in drawing area,this program write for first time .thanks for your attention
Best regards
Ade Suharna
;| LINES , Creat rectangle by autolisp
Design by Ade Suharna , for first time to write program on Autolisp
Variables:
p1/p2/p3/p4 Point for user input |;
(defun c:lines (/ p1 p2 p3 p4)
(setq p1 (getpoint "\nEnter first point: "))
(setq p2 (getpoint "\nEnter second point: "))
(setq p3 (getpoint "\nEnter third point: "))
(setq p4 (getpoint "\nEnter fourth point: "))
(command ".line" p1 p2 p3 p4 p1)
(princ)
)
I hope you don't mind a few comments.
0. Your program works! Congratulations.
1. You need to terminate the LINE command with an ENTER, just as if you were doing it on screen. In (command) a pair of "" will do it. Thus:
(command ".line" p1 p2 p3 p4 p1 "").
2. At this stage you don't have a rectangle. You will enjoy going ahead and writing the code to assure a true rectangle. (Hint: you only need 3 points.)
3. If you make the previous point part of the (getpoint) the computer will provide a "rubber band" line so you can see where you are going. (setq p2 (getpoint p1 "\nEnter second point: "))
4. Even so, it's really hard to see the figure until it's finished. Check out (grdraw), which will lay down a temporary line until the screen is redrawn. (grdraw p1 p2 1) ;right after you have acquired p2. The 1 colors the temp. line red.
..
Good luck, keep trying.
rs