A script for choosing different layer states

Is there a script for choosing different layer states? If there were then one could attach it to an alias and with a keystroke seemingly animate parts of model by changing different layer states.

For example, let’s say one arrangement of layers shows a telescoping object retracted, and another shows it extended. With layer states connected to an alias one can switch back and forth easily.

Any generous script programmers would be appreciated.

Thank you.

Hi Cosmas,

Try the attached button. lyrStates.rui (5.1 KB)
Download it, and drop it onto your Rhino workspace.

Note that for the placement of objects, one would generally use the NamedPosition feature…

Hi Djordje,

Thank you so much for your quick reply. I downloaded the button and dragged it in to my viewport but am not sure how to use it. When I click on it, it gives me a choice of which layer state I want, but what I am looking for is a script that I can attach to an alias that would choose a particular layer state. That way, let’s say I have a demonstration coming up and I have three arrangements of layers on and off that I want to present, I can go from one to the other and back with just the press of a button (meaning an alias). What do you think?
Thank you.

Good morning Wim,

Yes – I thought of namedpositions but, here, too, let’s say you have a mechanical object and you want to set it up so that it’s moving parts are in different positions – linked to named positions – is there a way to call up each one of those positions with an alias?

it’s the speed that I am looking for, where when you have a client looking over your shoulder you are not using your mouse to move your cursor to a particular layer state or named position on a panel, but just using your fingers.

What do you think?

Won’t the layer state manager allow you to do that directly? In Windows you can dock it as a panel. You just have to click on the state you want and hit restore.

You can also macro the layer state manager if you have saved the layer state already and know the name of the state you want to restore:

_-LayerStateManager _Restore "MyLayerState" _Enter

–Mitch

I wasn’t reading your reply thoroughly, sorry about that.
Do what Mitch has just told you, just add the hyphen on _-LayerStateManager to suppress the dialogue box.

Thanks djordje, forgot that… :sleeping:

Thanks, Mitch. That’s exactly what I wanted.

Thank you, very much.

And the same applies to _-NamedPosition :wink:

Excellent.