Creat first of autolisp program

Adesu

Usenet Archive
Joined
Aug 11, 2003
Messages
537
Reaction score
0
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
 
(command ".line" p1 p2 p3 p4 p1 "")

is that what you mean?
how to complete the line command?

or you could also do
(command ".line" p1 p2 p3 p4 "c"); to close the line with starting point

also you should probably do this:
(command ".line" "_non" p1 "_non" p2 "_non" p3 "_non" p4 "c") to be sure you get the right points and not affected by running osnaps in a crowded drawing

hth
mark
 
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
 
Thanks you to All , I very glad to solve this problem ,and I'm not alone ,now I increase knowledge to learn it, if I want to "Fillet" this rectangle with r=0.5 ,how to write it,thanks
 
Adesu said:
Thanks you to All , I very glad to solve this problem ,and I'm not alone ,now I increase knowledge to learn it, if I want to "Fillet" this rectangle with r=0.5 ,how to write it,thanks
Instead of LINE draw a polyline. Then (command "fillet" "p" . . .). If you really have to have a set of lines and arcs, explode it. (command "explode" "L" "")

rs
 
How to get input and fill in ,from point p1 to p2 than point p1 to p3,thanks
 
Use the previous suggestion to use a pline to draw the rectangle and fillet it.

Also, try the (getcorner) function to get the opposite point of the rectangle. You might like that better (or maybe not, but why make the user pick 4 times?).

--
R. Robert Bell, MCSE
www.AcadX.com

| How to get input and fill in ,from point p1 to p2 than point p1 to p3,thanks | | > Adesu wrote:
| > > Thanks you to All , I very glad to solve this problem ,and I'm not | > > alone ,now I increase knowledge to learn it, | > > if I want to "Fillet" this rectangle with r=0.5 ,how to write | > > it,thanks | > > | > Instead of LINE draw a polyline. Then (command "fillet" "p" . . .). If | > you really have to have a set of lines and arcs, explode it. (command | > "explode" "L" "") | > | > rs | > | > | | |
 
R. Robert Bell said:
Use the previous suggestion to use a pline to draw the rectangle and fillet it.

Also, try the (getcorner) function to get the opposite point of the rectangle. You might like that better (or maybe not, but why make the user pick 4 times?).

I played with the (getcorner) function but could not get it to parallel a sloped line. Even when I set the usc to that line. I believe it would only work if I rotated the view, too. That would make the code more complex than it's worth. (And confuse the user.)

rs
 
That's a limitation to that function.

--
R. Robert Bell, MCSE
www.AcadX.com

| R. Robert Bell wrote:
| > Use the previous suggestion to use a pline to draw the rectangle and | > fillet it. | > | > Also, try the (getcorner) function to get the opposite point of the | > rectangle. You might like that better (or maybe not, but why make the | > user pick 4 times?). | | I played with the (getcorner) function but could not get it to parallel | a sloped line. Even when I set the usc to that line. I believe it would | only work if I rotated the view, too. That would make the code more | complex than it's worth. (And confuse the user.) | | rs | |
 
Use the RECTANG command with PAUSE to get
a rotated rectangle corner, then erase the
polyline it creates after you get its vertices.
 
Tony said:
Use the RECTANG command with PAUSE to get
a rotated rectangle corner, then erase the
polyline it creates after you get its vertices.
RECTANG is parallel with the ucs, so would have to establish that first, run the command, reset ucs, select the new rectangle and extract the corners.

Not that it won't work, but Adesu wanted to make his own rectangle program and it seems like drawing a rectangle to find its corners so he can draw a rectangle is a little inefficient.

rs
 
Right - RECTANG is parallel with the UCS, and that's
how rectangle dragging should work (think non-plan
view).

Of course, if he wants to offer a rotate option he
can and that would require a temporary rotation of
the UCS, but that's not really all that big a deal,
nor is the creation/deletion of a polyline.
 
TCEBob said:
RECTANG is parallel with the ucs, so would have to establish that first, run the command, reset ucs, select the new rectangle and extract the corners.

Not that it won't work, but Adesu wanted to make his own rectangle program and it seems like drawing a rectangle to find its corners so he can draw a rectangle is a little inefficient.

rs

Yes that right,I want simple program,because I first writed it,as beginner me need not complex procedure program,be confused to me,like INITGET. I've tried program from Ronald W.Leigh at lesson 1 in sample program MSLOT.LSP (netcom.com) ,than duplicated it without INITGET and tried it,after test it OK and can it run,it's surprise for me.
 
Adesu said:
TCEBob can you suggest me ,how my program not like figure left side,why input for "specify center point of array" only X value,if me filled Y value color of program can't change and failed.
Thanks you for attention

I think we are having a language problem. Or maybe my morning coffee
hasn't taken effect yet. Where does "specify . . . array" come in? You have not given any array commands.

You are right to start very simple. If you want to program a rectangle then I suggest you make it as simple as possible so it works, and then add or change to make it more convenient or flexible. Here is a suggestion for a way to proceed:

First, be sure that Orthomode is on.
Next, get 3 points from the user. Ortho will assure 90 Deg. Next, turn off Orthomode. Next, compute the 4th point. Last, draw the figure from point to point.

Hope that helps

rs
 
Adesu said:
Here is you suggest it,it's right ?, and why the render command can't do it,what wrong in my program,can you suggest it thank you for you attention. TCEBob wrote:

Um, you have changed the program a little since the first post. I do not know what you are trying to draw, but it certainly is more than a rectangle. Since you are trying to work with solids I must humbly step down, as I have no experience there.

The program does not run for me but that may be because I am using Land Deskop.

rs
 

Latest threads

Back
Top