New layer visibility feature and code

Hi @dale,

I’ve got a scripts which apply transforms to objects which can be on a hidden layer or sublayer. In Rhino 7 i can just apply the transform and use obj.CommitChanges() and the transform is applied even when the layer is not visible.

Rhino 8 WIP (Windows) crashes when i do not enable the objects layer visibility prior transform at the point when i do obj.CommitChanges().

Therefore i’ve tried to store the layers visibility before object transform, set the layer to visible and do the object transform. If i then re-store the previous visibility of the layer (eg. hidden), i end up with some red light bulbs in the layer’s panel.

How to get rid of this and re-store the normal (gray) light bulb for the hidden state ?


Hi @clement,

If you have a way to crash Rhino via scripting, please provide a script, we can run here, that reproduces the behavior.

The layer functions, in RhinoCommon, work the same in the Rhino WIP as they do in Rhino 7 and earlier.

Visually, layer that are off everywhere (globally) now show as a reddish light blub. This is different than earlier Rhino versions. Layers that are off in a given view, either model or layout/detail, show as a blueish light blub.

To control layer visibility in model views, use the new Layer.ModelIsVisible property. Note, for layers to be visible in model views, they must be visible globally, Layer.IsVisible. This is the same behavior Rhino has always had for layout/detail layer visibility.

– Dale

Hi @dale, thank you i will send an example script and file via PM.


oh cool feature, thanks for writing about it

Hi @dale, after working on larger files with multiple hidden layers, i wanted to express that the red color choice for hidden layers was probably not the best.

Imho, semantically, if layer visible is yellow, hidden cannot be red as it gathers higher attention. Would it be possible to rethink the color concept and stay with something which includes more grayish color(s) for the hidden layer state(s) ?

This is what confuses me in Rhino 8, i am using Layer.IsVisible = False to hide layers and sublayers in a file without any layouts. The result are not blue light bulbs but only red ones. If i click on one of those red light bulbs to first show then hide again in the layer’s panel, the color is blue and not red.

Please refer to below image:

The code to hide the sublayers of the “Default” layer is this:

import Rhino
import scriptcontext

def DoSomething():
    index = scriptcontext.doc.Layers.FindByFullPath("Default", -1)
    if index >= 0:
        layer = scriptcontext.doc.Layers[index]
        children = layer.GetChildren()
        if children is not None:
            for child in children:
                child.IsVisible = False

Is this supposed to work like this in Rhino 8 or do i miss something ?

Hi @clement,

We’re still working out the final UI. It’s possible the red images, which indicate the layer is off everywhere (globally), might change to some other color or perhaps just change the hue. We’ll probably stay away from gray, what with the dark mode work that is going on.

Looks like there is an issue with Layer.ModelIsVisible not triggering a layer table event, like Layer.IsVisible does. I’ve logged this issue.


– Dale

Hi @dale, thanks for logging this.


thought college was going