How does one unlock all layers in one click?


#1

Hi,
How does one unlock all layers in one click ?

Steve


#2

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.
RM

-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

		Next

	End If
End Sub
)

UnlockAllLayers.rvb (397 Bytes)


#3

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():
    rs.EnableRedraw(False)
    for layer in rs.LayerNames(): rs.LayerLocked(layer, False)
UnlockAllLayers()

–Mitch


(Dale Fugier) #4

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

_NoEcho _-Layer _Unlock * _Enter

Force Select in Rhino 5?
#5

Dang, I always forget about the * wildcard…

–Mitch


#6

Cheers,
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.

Steve


(Dale Fugier) #7

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

For adding toolbars:

http://docs.mcneel.com/rhino/5/help/en-us/toolbarsandmenus/toolbar_button_editor.htm

Adding scripts to buttons:

http://4.rhino3d.com/5/rhinoscript/introduction/running_scripts.htm


#8

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


http://wiki.mcneel.com/developer/macroscriptsetup

–Mitch


#9

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


#10

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.


(Pascal Golay) #11
! _-Layer _Lock * _Enter

&

! _-Layer _Unlock * _Enter

should do it.

-Pascal