Jump to content

Recommended Posts

Posted

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

Posted

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)

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...