Distance question

Xolo

Usenet Archive
Joined
Aug 6, 2003
Messages
80
Reaction score
0
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
 
I couldn't remember that for the life of me.

Thanks to both of you TCEBob and Jason.
 
Hello TCEBob,

(getdist) helps getting distance between two picked points on screen. If you already have the values in two variables, (distance p1 p2) returns their distance.

- Rakesh
Look up (getdist).

rs
 
Rakesh said:
Hello TCEBob,

(getdist) helps getting distance between two picked points on screen. If you already have the values in two variables, (distance p1 p2)
returns their distance.

- Rakesh
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
 
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 ">")) )
)
 

Latest threads

Back
Top