# Thread: determining positions of 2 points on drawing

1. ## determining positions of 2 points on drawing

hi pple, just wish to ask if anyone has a better way to write a program to check 2 points and determine which is on the left/top which is at the right/bottom in a drawing then using the car/cadr command and comparing x y coordinates?? thanks

2. ## Re: determining positions of 2 points on drawing

Originally Posted by tany0070
hi pple, just wish to ask if anyone has a better way to write a program to check 2 points and determine which is on the left/top which is at the right/bottom in a drawing then using the car/cadr command and comparing x y coordinates?? thanks
Hi tany,
I just write a code for you,I'm not sure this code is right and can help you,and test it.

Code:
```(defun c:test (/ bp1 bp2 ss1 ss2 sse1 sse2 x1 x2 y1 y2 z1 z2)
(setq ss1 (car (entsel "\nSelect an object point in left top")))
(setq ss2 (car (entsel "\nSelect an object point in right bottom")))
(if
(and ss1 ss2)
(progn
(setq sse1 (entget ss1))
(setq bp1 (cdr (assoc 10 sse1)))
(setq x1 (car bp1))
(setq sse2 (entget ss2))
(setq bp2 (cdr (assoc 10 sse2)))
(setq x2 (car bp2))
(if
(and (> x2 x1)(> y1 y2))
"\n"
"\nLeft top in ( " (rtos x1) " , " (rtos y1) " , " (rtos z1) " )"
"\n"
"\nRight bottom in ( " (rtos x2) " , " (rtos y2) " , " (rtos z2) " )"))
)   ; if
)     ; progn
)       ; if
(princ)
)         ; defun```

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•