Turn off layer of selected object

Hey there:
A lot of times I find myself with a bunch of objects on different layers and I really want to turn off or lock the layer that a specific object is assigned to.
Back in the dark days when I was in AutoCAD user, there was a command on the toolbar that allowed me to start the command and then select an object in my drawing. Whatever object I picked, it’s layer would be turned off and the object would become invisible.

Could you please tell me if there is a way in Rhino to do the same thing with the tool button or alias command?
Thanks,
Don

There is a script that let’s you select one or more objects, and then it will mark their corresponding layers. The Layers tab must be opened during that time. I don’t remember the name of the script, but probably other users could find it somewhere.

Edit: Here it is:

Highlight layers:
HighlightLayers.py (683 Bytes)

Copy this inside a button:

-runscript (
' TurnOffLayerByObject

Dim strObject
strObject = Rhino.GetObject("Pick any object")

If Not IsNull(strObject) Then

Dim srtLayerName
srtLayerName = Rhino.ObjectLayer(strObject)

If Not IsNull(srtLayerName) Then
Rhino.LayerMode  srtLayerName , 1
End If

End If
)

Oh, wait, here it is!


just use this ^

Hi @doncstevens,

  1. Select the objects on the layers you want to run off
  2. In the Layers panel, drop down the Tools button menu a click Select Object Layers.
  3. Click the lightbulb of one of the select layers.

or

  1. Select the objects on the layers you want to run off
  2. Run the HighlightObjectLayers command`.
  3. In the Layers panel, click the lightbulb of one of the select layers.

– Dale

1 Like

Or you can put the following script on a button. Select the objects, click the button and the selected objects’ layers will be turned off. Note that if one of the selected objects is on the current layer, another layer (the most recently added layer that is not in the list to be turned off) will automatically be made current. Also, if you turn off a parent later, the child layers under it will also be automatically turned off.

MultiObjLayersOff.py (892 Bytes)