A Way to Get Color of the Current Rhino Layer?

Hi, I’m new to Rhino/GH and I am impressed by how easy its been to do some pretty complicated things in GH by learning from all of you on line, so thank you. I have one question that has me stumped.

I have a GH definition that creates a child layer for whatever layer is active at the time, and puts some calculated geometry on it. That part works fine. I would like to set the color of that child layer to whatever the color of the parent (current) layer is, which might be different every time you do this with a new layer. I have found a way to list the layers and colors for ALL the layers, but I haven’t found a way to get the color for one particular layer and send that color to the bake component for my child-layer geometry. Any ideas?

Thank you in advance.

I suppose you are using Elefront or Human plug in?

Human can list all layers active in current Rhino document.

You can the just use List Item to select the layer you want together with its color.
Or you could also input the name of the layer you want, in this case ‘A’ and have that find the index to input into the List Item for you.

And with code when you get the layer its color you can query through the Layer.Color Property. The current layer you can get through LayerTable.CurrentLayer Property, where LayerTable is RhinoDoc.Layers Property of the document you are working with.

Thank you so much! I knew how to list the layers but not how to filter them to find the one I needed! Much appreciated!

Sorry, what is that component with the M on it that finds the index of the layer I’m looking for?

image001.png

image002.png

image003.png

image004.png

image005.png

image006.png

Member Index

-wim

Thank you!

image001.png

image002.png

image003.png

image004.png

image005.png

image006.png