Baking to Previously Created Layer - GH Rhino Components

Hi,

I am creating a new Rhino layer like so:

When I first press ‘bake’ this layer is created in my Rhino document.
Now I want to change the color of the layers, add materials, etc.

When I bake again, the layer is overwritten. How can I avoid this?

Example.gh (16.8 KB)

The name needs to be changed to create new layers. In this case because the layer name already exists, then it can only replace it.

Changing the name would work, or using Cache Names with Branch Naming option are two ways to change the name of the layer. Content Cache Name Guide

There are a series of objects in Rhino that must have unique names. Most of them are in Tables in the header of the model. Blocks, Layers, LineTypes, Annotation styles, etc…

Hi Scott, thanks for the reply.

Once I have baked once, and created the layers, I don’t want to create new layers anymore.

I assigned some V-Ray material to the layer manually, and then when using bake again it deletes the material I just added (because its replacing the layer all over again). :sob:

I guess I could add an IF/OR gateway, meaning if it finds layers on the Rhino document make this, and if not create the layers.

I need to look into that. Thank you for the extra information.

I have this issue too, and use a bit of if/or code I found here on the forum to avoid overwriting layers. I think it maybe came from Kike Garcia?

This is how I would do it. Once it is committed to the Rhino doc, then use the existing ID, from the result of the Bake component, to update the existing layer instead of overwriting it with a new Bake.

Of course if the Layer exists allready in the model before the Grasshopper doc, then use the Query layer to find it and get its ID.

Technically there could be a query watcher for the layers to grab the ID:

1 Like

Yeah, this could be good. There are some layer settings (namely section styles) that I can’t access in GH so I usually create the layers in Rhino first with the settings I want and then pull them in.