Jump to content

Multiple selection sets


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 post
Share on other sites
confutatis
(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 post
Share on other sites
Lee Mac

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