dtv8997 Posted September 16, 2009 Posted September 16, 2009 My friend helped me write this (im pretty new to lisp) but in this part of the lisp i want to change the color of the line to color 30 if it adds it to the list. That way i can tell which lines i have already picked. As of now if i have a bunch of lines i end up clicking the same ones a few times, this would eliminate that problem. (setq CNT T);Simple on/off toggle for while loop (while CNT (if (setq PICKLINE (entsel "\nPick Centerline of Pipe:\n")) (COND ((not ssete);List does not already exist, create new lists. (setq ssete (cons (car PICKLINE) ssete)) );end cond ((and ssete (not (member (car PICKLINE) ssete)));Lists exists, check if object already exists in the entity list (setq ssete (cons (car PICKLINE) ssete));add entity name to entity list );end cond (t (princ "\nObject previously selected."));If object already exists in the list, );end COND~ ;|else|;(if (= (strcase (getstring "Selection Complete?. Exit? (Y/N)")) "Y") ;|then|;(setq CNT nil);No object selected, set CNT=nil to drop out of while );end if );if );while Quote
gile Posted September 16, 2009 Posted September 16, 2009 Hi, Here's a way. It uses the ERRNO sysvar value to end the while loop: ERRNO is set to 52 if the user type Enter, Space or right click. It uses the redraw function to highlight the selected entities. If an entity is selected twice it's unhilight and removed from the list (a kind of undo). (setvar 'errno 0) (while (/= (getvar 'errno) 52) (if (setq ent (car (entsel "\nSelect an entity: "))) (if (vl-position ent lst) (progn (setq lst (vl-remove ent lst)) (redraw ent 4) ) (progn (setq lst (cons ent lst)) (redraw ent 3) ) ) ) ) Then to unhilight the entites of the list, just do : (mapcar '(lambda (x) (redraw x 4)) lst) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.