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.

2 Likes

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

Does that do it?

-Pascal

2 Likes

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__":
    HighlightLayers()

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.

-Pascal

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

Thanks, that’s just what I needed!

Perfect :slight_smile: thanx alot!..

OneLayerOff command does it well.

1 Like

THIS! :grinning:

Hey Pascal,

Is there anyway that we can select the object and it shows us to which layer it belongs to? Instead of searching for layer it belongs to?

Thanks a lot!
Aras

Hello, not sure if this is what you mean, select object, view the properties panel

Or you can select the object and type “_What” which will give you all the properties of said object.

Is there a macro that “Select the layer on which object is on?”

Hello- HighlightObjectLayers in V8.

-Pascal

1 Like

Hello.

So still a manual operation instead of being automatic. :expressionless:

McNeel devs really don’t think very much about RSI. :stuck_out_tongue: