Distance question

Discussion in 'AutoCAD' started by Xolo, Jan 19, 2004.

  1. Xolo

    Xolo Guest

    Hey everyone,

    Have a quick question.

    I'm making a lisp and need to know how to get a distance (a number value)
    from user picked points. Take a look at the example;

    (setq p1 (getpoint "\nPick Point 1:"))
    (setq p2 (getpoint "\nPick Point 2:"))

    Now here I want to use the two points to get a length and set it to a
    Length;

    (setq L (what goes here))

    What would I put in there for it to be a real positive number? Or would
    there be a better way of writing this?

    Thanks for all your help,

    Xolo
     
    Xolo, Jan 19, 2004
    #1
  2. Xolo

    TCEBob Guest

    Look up (getdist).

    rs
     
    TCEBob, Jan 19, 2004
    #2
  3. (distance p1 p2)
     
    Jason Piercey, Jan 19, 2004
    #3
  4. Xolo

    Xolo Guest

    I couldn't remember that for the life of me.

    Thanks to both of you TCEBob and Jason.
     
    Xolo, Jan 19, 2004
    #4
  5. Xolo

    Rakesh Rao Guest

    Rakesh Rao, Jan 20, 2004
    #5
  6. Xolo

    TCEBob Guest

    Yo, Rakesh,

    Just so. The way I read the question was that getting the points was
    only to find the distance. If p1 or p2 are needed later then the three
    steps make sense.


    rs
     
    TCEBob, Jan 20, 2004
    #6
  7. Xolo

    Adesu Guest

    Here my code,you can try it

    ; tpd is stand for two point distance
    ; Design by Ade Suharna <>
    ; 22 October 2004
    ; program no. 121/10/2004
    (defun c:tpd ()
    (while
    (setq p1 (getpoint "\nCLICK FIRST LOCATION FOR POINT: "))
    (setq p2 (getpoint "\nCLICK SECOND LOCATION FOR POINT: "))
    (setq p1p2 (rtos (distance p1 p2)))
    (setq str "LENGTH OF POINT IS")
    (alert (strcat str " " "<" p1p2 ">"))
    )
    )
     
    Adesu, Oct 22, 2004
    #7
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.