How does one unlock all layers in one click?

How does one unlock all layers in one click ?


Copy the attached text below to an icon or use the attached rvb script.
You can use this script to lock all layers too by deleting the word false and the ’ symbol in front of the word true and leaving the word true.

-RunScript (
Option Explicit
'Script version Tuesday, June 03, 2014 2:06:52 PM
Call UnLockAllLayers()
Sub UnLockAllLayers()
	Dim arrLayers, strLayer

	arrLayers = Rhino.LayerNames

	If IsArray(arrLayers) Then

		For Each strLayer In arrLayers

			Rhino.LayerLocked strLayer, False'True


	End If
End Sub

UnlockAllLayers.rvb (397 Bytes)

Easiest way is to select the top layer, scroll to the bottom and shift+select the bottom layer (will select the whole layer list) and then hit the lock button… twice (first time will lock everything not yet locked, then second will unlock them all).

Otherwise setting up a button is probably the best:

import rhinoscriptsyntax as rs
def UnlockAllLayers():
    for layer in rs.LayerNames(): rs.LayerLocked(layer, False)


Or just assign the following command line macro to an alias or toolbar button:

_NoEcho _-Layer _Unlock * _Enter

Dang, I always forget about the * wildcard…


Can anyone point me to where there is a video or pictorial tutorial or something on how to apply scripts to buttons, attach text to icons, use an rvb script, assign command line macro to an alias or toolbar button etc ?

also python scripts…and anything else of this nature.

All mentioned in your replies for which I am very grateful.

With these various options and not knowing whats involved, I am a little bewildered and we all have to start somewhere learning. I havent ever done scripts and macros. My first ever attempt in V4 caused me to have to reinstall V4 !

I would like to see a right click option at top of padlock column giving all on or off, or even with left click there, as I had in Freehand.


All this stuff is in one help file (or another).

For adding toolbars:

Adding scripts to buttons:

For running Python scripts (V5 only…) you need to use -_RunPythonScript and not just -_RunScript…


Thanks for the links.
I hope they will enable me to get my head around why a variety of hammers to hit a nail.

if only we were just using hammers to hit a nail… but even then we can still buy about 30 or more different hammers for hitting nails.

! _-Layer _Lock * _Enter


! _-Layer _Unlock * _Enter

should do it.