Hide specific Layer from panel

Hello ,

There is some way to hide a layer specific from Layers Panel ? ex:“Layer 04”.

Hide Layer

Thank you

Hi @MatrixRatrix,

I don’t know of any way - sorry.

Why do you want to hide a layer?

– Dale

I have a code that hides the layer a given object is on. I’ll see if I can find it tomorrow.

Hi @dale

Basically I’m making my own layer panel, I would like my layers not to
be exposed in the rhino layer panel.

Thanks

Hello @Holo ,

It would be nice if you could find it.

Thanks

Sure, here is a simple python script that I have in a button.
And if you need it in Rhino Common then it is basically the same approach, get the layer some how and turn it off.


!_-RunPythonScript (

### Hide objectlayer

import rhinoscriptsyntax as rs
obj = rs.GetObject("object to hide layer", preselect=True)
if obj:
    layer = rs.ObjectLayer(obj)
    
    if not rs.IsLayerCurrent(layer):
        rs.LayerVisible(layer, visible=False)
    else:
        print "object is on the active layer"

)

Oh, shoot, I just realized I missunderstood the topic, you want the layer to not be visible IN the panel, not turn it off… Suddenly the blue scribble made a lot more sense… Sorry for being so darn daft!
Unfortunately I have no idea on how to do what you ask.

@Holo

It doesn’t hurt and I appreciate the effort.

Thank you

1 Like

You can create your own layer panel using eto form in python. And there you can have full control of what you would like to show.

@Wiley

I also remembered this, but I would always have the default layer panel that could collide with my layer.

Maybe I can also overrride the default layer panel of rhino , but do not know if it would be the cleanest solution.

Thanks

Why do you not want to not use visible Rhino Layers? Your panel could manage Layers in duality with the Rhino Layer panel, or are these layers specific to your plugin?

Hi,
Layers don’t have to be necessarily hidden from the user, I just don’t want the user to be allowed to select or modify any property, and as far as I could go, I just couldn’t prevent the user from selecting the layer, with the selection he can delete the layer which would be very bad for my plugin.

Yes, these layers are specific to my plugin.

Thank you

Is there a way to script Layer filters?

image

@martinsiegrist

I was also looking for this, and with this function it solved my problem, but apparently there is no way.

1 Like

It may sound as stupid question, but do you really need to keep objects you want to hide in a layer? If you would not store them in Rhino file, but in Rhino session memory instead, then this problem would not exist. They could be displayed within a conduit.

Good question.

Yet I’m wondering why layer filters don’t seem to be scriptable?

@mlukasz87

It’s not a stupid question,

I want to save the objects inside the .3dm file .

Maybe there is another way, but I also already have a lot of code developed for the layers that I would like to keep.

Or maybe look for another solution and redo the code, maybe it’s not bad at all.

Thanks

It is possible to store plugin data in .3dm file. Your plugin could read it and recreate content after some event or command.

But yes this is different approach and may require a lot of changes in code.