Select layer on which object is on?

Hello everyone,

I am looking for a way to work more efficiently, and many times I need to hide a specific layer. I work with many layers and make2ds and sometimes it gets hard finding that one layer to turn off. Isnt there a way to:

  1. select the object. Select the layer the object is on. Turn off the layer.

Note that simply selecting all objects with same layer attribute and hiding them would not be ideal, the ideal thing would be to turn off the layer

Thank you.

Hi ShynnSup - when you have your objects selected, click on the hammer icon in Layers and choose 'Select object layer"

Does that do it?


Hey Pascal, thats it!
Thank you!

Any way this could be made into a macro/hotkey?

Hi Chris - there is not, that I know of, in plain Rhino but it should be scriptable. I’ll take a look…

Here’s a quick Python:

import scriptcontext as sc
import rhinoscriptsyntax as rs

def HighlightLayers():
    ids = rs.SelectedObjects()
    if not ids:return
    layers = [rs.ObjectLayer(id) for id in ids]
    layers = list(set(layers))
    for layer in layers:
        parent = rs.ParentLayer(layer)
        while parent is not None:

            rs.ExpandLayer(parent, True)
            parent = rs.ParentLayer(parent)
    layers = [sc.doc.Layers.FindByFullPath(layer, -1) for layer in layers]
    sc.doc.Layers.Select(layers, True)
if __name__ =="__main__":

Oh, I see Clement made something as well - you should be all set. Ah darn, - the script is V6, let me try it in V5… yeah looks like V6 only.


1 Like

Hi @pascal and @chrisariasd,

this macro seems to work for multiple objects on multiple layers:

_SelNone _-Layer _Off _Select _Pause _Enter

Note that the current layer cannot be hidden.

Thanks, that’s just what I needed!

Perfect :slight_smile: thanx alot!..

OneLayerOff command does it well.

THIS! :grinning: