Jump to content

Multiple selection sets


mhupp

Recommended Posts

Is there a better way to do this? only want to make one manual selection for two or more Selection sets.

Currently I am using the following.

 

(if (setq SS (ssget)) ;Basic ssget to select everything
  (progn
    (if (setq SS1 (ssget "_P" '((0 . "LWPOLYLINE,CIRCLE") (8 . "layer") (410 . "Model")))) ;first selection 
      *do stuff
    )
    (vl-cmdf "_.Select" SS "")  ;is their a visual lisp of this command
    (if (setq SS1 (ssget "_P" '((0 . "LWPOLYLINE,CIRCLE") (8 . "diffrent layers") (410 . "Model"))))  ;second selecion
      *do other stuff
    )
  )
  (prompt "\nNothing Selected")
)

 

Link to comment
Share on other sites

(if (setq SS (ssget)) ;Basic ssget to select everything
 (if (setq SS1 (ssget "_P" '((0 . "LWPOLYLINE,CIRCLE") (8 . "layer") (410 . "Model")))) ;first selection 
  *do stuff
  (if (setq SS1 (ssget "_P" '((0 . "LWPOLYLINE,CIRCLE") (8 . "diffrent layer") (410 . "Model"))))  ;second selecion
   *do other stuff
  )
 )
 (prompt "\nNothing Selected")
)

 

Edited by confutatis
Link to comment
Share on other sites

I would suggest the following approach - acquire a selection set representing the union of the two sets and then use a conditional statement when iterating over the set:

(if (setq s (ssget '((0 . "LWPOLYLINE,CIRCLE") (8 . "Layer,Different Layers") (410 . "Model"))))
    (repeat (setq i (sslength s))
        (setq i (1- i)
              e (ssname s i)
        )
        (if (wcmatch (cdr (assoc 8 (entget e))) "Layer")
            (progn
                ;; Do something
            )
            (progn
                ;; Else do something
            )
        )
    )
)

 

Edited by Lee Mac
  • Like 2
Link to comment
Share on other sites

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...