Creat first of autolisp program

Discussion in 'AutoCAD' started by Adesu, Jan 8, 2004.

  1. Adesu

    Adesu Guest

    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
     
    Adesu, Jan 8, 2004
    #1
  2. Adesu

    Mark Propst Guest

    (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
     
    Mark Propst, Jan 8, 2004
    #2
  3. Adesu

    TCEBob Guest

    ====================
    ;| 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
     
    TCEBob, Jan 8, 2004
    #3
  4. Adesu

    Adesu Guest

    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, Jan 8, 2004
    #4
  5. Adesu

    TCEBob Guest

    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
     
    TCEBob, Jan 8, 2004
    #5
  6. Adesu

    Adesu Guest

    How to get input and fill in ,from point p1 to p2 than point p1 to p3,thanks
     
    Adesu, Jan 8, 2004
    #6
  7. 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, Jan 8, 2004
    #7
  8. Adesu

    TCEBob Guest

    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
     
    TCEBob, Jan 11, 2004
    #8
  9. 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
    |
    |
     
    R. Robert Bell, Jan 11, 2004
    #9
  10. Use the RECTANG command with PAUSE to get
    a rotated rectangle corner, then erase the
    polyline it creates after you get its vertices.
     
    Tony Tanzillo, Jan 11, 2004
    #10
  11. Adesu

    TCEBob Guest

    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
     
    TCEBob, Jan 11, 2004
    #11
  12. 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.
     
    Tony Tanzillo, Jan 12, 2004
    #12
  13. Adesu

    Adesu Guest

    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, Jan 12, 2004
    #13
  14. Adesu

    TCEBob Guest

    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
     
    TCEBob, Jan 12, 2004
    #14
  15. Adesu

    TCEBob Guest

    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
     
    TCEBob, Jan 14, 2004
    #15
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.