Author Topic: Invert Selection  (Read 5834 times)

0 Members and 1 Guest are viewing this topic.

M-dub

  • Guest
Invert Selection
« on: December 05, 2007, 01:45:32 PM »
Let's say you've got 15 of 20 entities selected for whatever reason.  (Copy, Move, Erase, etc...)

Now, let's say you want the other 5 entities selected INSTEAD of the 15 you already have selected.  Is there a way to quickly invert your selection?  It would be nice if it was something like CTRL+Shift + select, much like Shift + select = Deselect.

Anyone?

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Invert Selection
« Reply #1 on: December 05, 2007, 02:19:45 PM »
Without resorting to writing a little proggy ...

Select the entities you don't want using the select command:

Select [enter] <select entities> [enter]

Now select all entities using the select command and then use the previous option to remove the previous ones you selected and don't want:

Select [enter] all [enter] remove [enter] p [enter] [enter]

Now go to your move command etc. When prompted to select entities just hit p [enter].

Does that work?
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Invert Selection
« Reply #2 on: December 05, 2007, 02:36:52 PM »
Here is my solution...

Code: [Select]
(defun c:invss (/ ss ss2 n)
  (setq ss  (ssget)
ss2 (ssget "_x")
  )
  (if ss
    (progn
      (repeat (setq n (sslength ss))
(ssdel (ssname ss (setq n (1- n))) ss2)
      )
      (if ss2
(sssetfirst nil ss2)
      )
    )
  )
)

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

M-dub

  • Guest
Re: Invert Selection
« Reply #3 on: December 05, 2007, 03:38:44 PM »
Does that work?

It would if it weren't for "all".  I'm just referring to a section of a drawing.

Ron's routine seems to work exactly the same.

If I had explained myself a little better in the first place, I'm sure you could have set something up there, too!

It's not a big deal... I was really just wondering out loud.   Actually, I was thinking that as part of the default 'deselect' (CTRL + select), it would be nice if it would work as dual function / (deselect the things that are already selected) and ((select the things that weren't before) but are now).

Clear as mud?

:)

Thank-you guys, but don't worry about it.  :)  Sorry for this!