Jump to content

Exclude objects from selection


itacad

Recommended Posts

Hi, after having obtained the selection of a certain number of objects (for example because they are positioned on a certain layer) scattered in a very large autocad file, it is possible to exclude from the selection those external to a selection window or, which is the same result, keep only those in a select window?

Greetings

Link to comment
Share on other sites

If you're using the QuickSelect command, you can include or exclude the objects you select in the current selection set, rather than the entire drawing. You can also append them to the current set. In other words, you can add or remove batches of objects from a set in multiple steps. You may need to plan out the sequence of steps more carefully, for instance selecting with a window before selecting by layer.

Link to comment
Share on other sites

Lisp Macro I've used for that purpose for 10 years now: (load "SSimWin.lsp") SSimWin

Select Similar within Window lisp function using SelectSimilar command by Alan J. Thompson, 2013.07.30.

https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/select-similar-by-window-selection/m-p/4348047#M313697

;| Select Similar within Window using SelectSimilar command by Alan J. Thompson, 2013.07.30.
https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/select-similar-by-window-selection/m-p/4348047#M313697
(load "SSimWin.lsp") SSimWin
 |;
(defun c:SSimWin (/ filter ss1 ss2 ss3 add i e)
  (setq filter (if (eq (getvar 'CVPORT) 1)
                 (list (cons 410 (getvar 'CTAB)))
                 '((410 . "Model"))
               )
  )
  (princ "\nSelect objects to select similar: ")
  (if (and (setq ss1 (ssget filter))
           (progn (princ "\nSelect area to select similar object(s) within: ")
                  (setq ss2 (ssget filter))
           )
      )
    (progn (command "_.selectsimilar" ss1 "")
           (if (setq ss3 (ssget "_I" filter))
             (progn (sssetfirst nil nil)
                    (setq add (ssadd))
                    (repeat (setq i (sslength ss3))
                      (if (ssmemb (setq e (ssname ss3 (setq i (1- i)))) ss2)
                        (setq add (ssadd e add))
                      )
                    )
                    (sssetfirst nil add)
             )
           )
    )
  )
  (princ)
)

Thanks Alan!

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