algorithmic modeling for Rhino

I want to group my definition lines to certain Layers when I bake. But it seems that what ever I do, I always get these Layers:

Layer 01
Layer 02
Layer 03
Layer 04
Layer 05

And I can only choose one layer of these to bake definition in.


On the end of my definition I have 8 "Line" components, which I connected to the "Data" parameter, and then bake it.

Now, I want to group certain of these lines into particular layers, this is why I tried to use the "Group" component to group certain "Line" component before connecting it to the "Data" parameter and baking it. But this did not work.

How can I achieve this?

Views: 3630

Replies to This Discussion

This website has a lot of baking scripts for the C# component that might help you out.

It seems the second script component is the one I need.

But I dot not know how to use it :(

You can download it as a grasshopper file, and I imagine just plug sliders and strings into it. I don't think you need to write additional script. Unfortunately, I'm not good with scripting either. Otherwise, I'd walk you though it. Surely, others on the board can help you out.


Good Luck!

I just tried doing it. I copied the whole code to my Grasshopper definition file, and then plugged my final "Line" components (the ones I want to bake) into the "Line" parameter, but nothing happens.
You do know grasshopper bakes onto whatever layer that is selected in rhino. You could just make new layers in rhino. Select the layer you want to bake to. Then bake the specific grasshopper items to that layer.

I know this Michael.

But I want to bake up certain part of my definition into 5 different layers.


This means that each time I want to bake some of these certain parts of my definition, I need to get back into the Rhino and change the Layer.


I was wondering if there is an automated process to do this directly from the Grasshopper.

I usually just use bake most attributes from Giulio.

Hi Djordje,


this is a simple version of the definition posted there. Is shows how to bake to specific layers. It's enough to give each object a corresponding layer name.

The "group" feature is mostly used in the Set and Transform menus at present as far as I know and is not directly accepted by "normal" components.

You might be interested in experimenting with Data caches, they should be useful in your case. The only current limitation is that they cannot change cache name dynamically, but only through direct input.

I hope this helps,


- Giulio
McNeel Europe


Thank you for the reply Giulio.


But I do not understand you. I need to connect each of my "Line" components output to the "object" input of the "bakeAttributes" component? And then how can I know which of these Lines of mine will be baked under which Layer?

I usually use multiple bake attributes components, place each group into its own bake attributes component. plug a note panel into the layer input and type the desired name of the layer. Then turn the Boolean toggle to true to bake it. This will create the named layer and bake the objects onto that layer. You can also adjust materials colors and even bake gradients. o take it further you can use grasshoppers material editor component.

Hello again Djordje,


maybe we need to take a step back and look at the standard way Grasshopper manages inputs.


In the script component we have two used inputs, say G (geometry) and L (layer names).

If list G and L have the same length, by default (longest list) the first element in list G goes with first element in L, second with second, third with third, etc.

Then, if one list is shorter, the last possibility in any list is used with all unpaired elements of the other. Say, 3 circles and 5 layer names. Then all circle will be baked once, except the last circle will be baked three times to be paired with layers #3, #4 and #5.

If there is only one layer and 4 circles, then all 4 circles will end into the same layer. The last  possibility is repeated as long as necessary: this is no exception to the rule.

Finally lists of lists (trees): if trees have the same structure, lists are used in the way specified above but only branches with the same path are matched with each other.
I normally suggest to use this pairing logic as last resort.


So, ultimately, you need to order geometry or layer names in a manner that will result in the correct pairing logic, given the standard input management outlined above.

I hope this helps. And if you post a definition, even a small one, I will try to assist with it.


- Giulio
McNeel Europe

Thanks. But by "flyout menu" you mean "context menu"?
I know about this possibility, but this means I need to rename my Layers each time I create a new Grasshopper definition (or rename them each time I run Rhino before running Grasshopper).
Besides the fact I want certain Lines from my Grasshopper definition to be in the certain Layers after baking, I want them to be in the Layers with precise name.

Hell again :)
Giulio I am apologizing if I did not understand you. I am a Grasshopper beginner and your far advanced programmer.
What you told in the last post was related to the Data matching with "Longest list" algorithm? If this is the case then I understood you - I need to have the same number of Layers like the number of my Lines I am inputing into the "obj" input of the "bakeAttributes". Right?

If this is the case then I understand you, but I do not understand what determines the order of my input lines into the "obj" input? Order of my Layers is determined by the order in which I write them in the Panel. But what determines the order of the Lines output I am inputing into the "obj" input of the "bakeAttributes" component?

By the way, Michaels advices (with baking separately each of the lines worked) but I am still interested if this can be done with only one "bakeAttribures".
I am attaching the .3dm and .ghx files. Giuliano sorry if I missunderstood you.






  • Add Photos
  • View All


  • Add Videos
  • View All

© 2021   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service