Filter selection: Select objects on inherited layers

Hi there,

I am wondering if there’s a way to do the following. When theres a complex array of varying geometry, sometimes I need to isolate a specific selection based on layer.

Is there a way to run a command which asks you to select some objects, then press enter. Rhino now knows that you only want the future selection to be from those layers of the previously selected geometry.

That means, I can have a large array of random objects, but when I do selection commands, it will only add objects that are on the layers of the objects which were previously selected during that command.

Is there something like this? Not sure if this makes sense


Hello - I suppose the way to do this is to lock the unselected layers, it amounts to the same thing I guess. Could be scripted I would say.

@jdelavaulx here are some quick and dirty pythons - do these accomplish what you need? (567 Bytes) (627 Bytes)

To use the Python script use RunPythonScript, or a macro:

_-RunPythonScript "Full path to py file inside double-quotes"


1 Like

HI Pascal,

I’m not sure that’s exactly what I mean, was hard to word it clearly.

I imagined something like:

Turn ‘filter’ on. It then asks you for the layers of your desired selection. To find these layers, you select either the layers themselves, but preferably, the objects themselves; and then the layers are determined from this. Now it has those layers, future selections are locked to those layers until it’s turned off.

Perhaps it was better worded as constrain selection to layers of selected objects


Hi Jeremy -

As Pascal wrote, the only way to do that is by locking (or hiding) the layers of all other objects. There is no other filter mode for layers.

One way I can think about this (as a potential scripted tool) is that once you define your “Filtered” layers set (whether from selected objects or Layers panel selection), there would be a script that unselects all objects that are on layers not belonging to your “Filtered” group.
But it would require running the script (from a button or alias) every time you want it filtered.

Perhaps there is a way in Python to merge this idea with some selection event watcher, but that’s above my head…


OneLayerOn command may be useful - you pick up one object to turn off all layers not holding this object.

Hi Jeremy,

Here is an idea:
DefineFilterSelectionByLayers.rvb (1.6 KB)
FilterSelectionByLayers.rvb (546 Bytes)

The first script will let you define the filtered layers, either from selected objects or layers in layer panel (or both). Once this is defined, the second script will always deselect everything from layers NOT defined in the first script.

I guess you can add these to some aliases or buttons for quick access if that helps and if you want a separate filter from selected objects, layers or both.
It still requires extra click to execute the filter, vs locking layers solution, but this is the closest I can think of with relatively simple scripts.



1 Like

Thanks so much Pascal, super helpful for these scripts :slight_smile:

Thanks so much Jarek, So glad that these scripts exist. I will try both these and Pascal’s soon :slight_smile:

Finally got around to testing these scripts. They work but seem to not work with complex layer hierarchies.
The easiest workaround is to select all objects on that layer, Isolate or isolate lock, then select, then unisolate.

Thanks for the scripts however.