
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 y1 (cadr bp1))
(setq z1 (caddr bp1))
(setq sse2 (entget ss2))
(setq bp2 (cdr (assoc 10 sse2)))
(setq x2 (car bp2))
(setq y2 (cadr bp2))
(setq z2 (caddr bp2))
(if
(and (> x2 x1)(> y1 y2))
(alert (strcat "\nPosition of Point"
"\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