hi, why does this stop right after the while and not assign values to the preceding variables? BTW I'm trying to check the endpoints of two lines to make sure that they are they same for survey boundary work. TIA Shawn (defun c:ce (/) (while (setq ent (nentsel) a (entget (car ent)) ; all attributes b (cdr (assoc 10 a)) ; E N EL c (list (car b) (cadr b)) ; E N ENDPOINT 1 d (cdr (assoc 11 a)) e (list (car d) (cadr d)) ; E N ENDPOINT 2 lst1 (append lst1 c e) ) ;end of setq ) ;end while (setq a1 (list (nth 0 lst1) (nth 1 lst1)) a2 (list (nth 2 lst1) (nth 3 lst1)) b1 (list (nth 4 lst1) (nth 5 lst1)) b2 (list (nth 6 lst1) (nth 7 lst1))) )
I C, I PUT the end of while at the end of the lisp and it works, just doesn't make since. the list (lst1) is already created why does the extractor (nth & car function) need to be inside of the loop?
No not really. Your while loop continues until you don't select a line. Then (entget (car ent)) errors out because ent is nil. a1, a2, b1, & b2 never get set. I still don't quite understand exactly what you're trying to accomplish. -- Ken Alexander Acad2004 Windows XP "We can't solve problems by using the same kind of thinking we used when we created them." --Albert Einstein just doesn't make since. the list (lst1) is already created why does the extractor (nth & car function) need to be inside of the loop?
You've put all your setq's in the while test, and nothing inside the while loop. This guarantees a crash as soon as the first setq of the bunch returns nil. Your while loop says: (while (setq_everything) ;nothing at all here ) It should say: (while (setq ent (nentsel)) (setq_everything_else) ) This will exit the loop correctly as soon as ent isn't selected.