Deselect objects by type

There are quite a few times I would like to unselect by object type to remove those items from a current selection.

For example, If I have a whole lot of things selected, and they are all different layers, colors, types of objects etc, and that I built this selection with a lot of various methods. but now but I want to exclude everything that is green from my selection, what would be nice is a command like _DeSelColor that would do the inverse of _SelColor… deselect by color from the current selection. This is just an example to illustrate why one would want an inverse selection function. I don’t want to change how I’m working, I want inverse selection functions of ALL the _Sel* type functions. So I can do this kind of thing any time I want as I see fit.

Being able to remove things from an existing selection by type is just as valid as making selections by type. My other CAD/CAM program lets me do inverse selections, and it would be super helpful for Rhino to have this ability as well. If there is already a way to do this please let me know, I couldn’t find it by searching for Desel, or Unsel I did see the selection filter, and that’s great for making some kinds of selections, and I see invert selection, but that just reverses everything which is also not what I want.

The commands don’t exist, but could be scripted up easily enough…

My experience with Rhino scripts is very limited, if it’s not too complicated could I please get an example? Once I get an idea how it could be done, I can probably come up with all of them.

workaround:
_namedSelection → save current selection
_selNone
_sel… for example _selClosedPolySrf
_lock
recall saved selection
_unlock

1 Like

Hi James - something along these lines, say to de-select circles:

import rhinoscriptsyntax as rs
import Rhino

ids = rs.SelectedObjects()
if ids:
    for id in ids:
         if rs.IsCurve(id):
             geo = rs.coercegeometry(id)
             rc,circle = geo.TryGetCircle()
             if rc:
                 rs.UnselectObject(id)

-Pascal

1 Like

Try this script:

UnselectByType.py (8.1 KB)

4 Likes

Thanks for the scripts everyone! I appreciate it.
@DanBayn I didn’t know we could have dialog boxes in scripts! Awesome solution!