How to bake curves from a custom preview with a gradient node plugged into the shader

I have been using the custom preview tool and gradient tool to create a set of multi coloured curves based off of the strength of their force.

  • The problem i am having is that when i bake the curves from the custom preview, the curves are no longer coloured and just turn black.

  • My question; is it possible to bake curves from the custom preview tool, and have them keep the colour that they were in the custom preview tool?

I can attach the model and script if it helps.

the gradient is applying only to a ‘custom preview’.
to bake with attributes you might need to use an addon for gH like human or elefront.

That is great help, thank you Aditya!

You can indeed bake a custom preview with color. You can also make a custom material.

you mean without using any addons? I tried doing so before trying elefront, but it all baked into the current layer and its default colour.

use the “Custom Preview” component inside “Display” tab then add a “color swatch” along with your input geometry. Then you can bake the “Custom Preview” Component with said color. You can also use Human to make a “Custom Preview Material”

My experience is that you can always bake gradients/swatches. If you post your script we could be more helpful.
Good luck!

Also, make sure your view mode in rhino is the appropriate one. You will most likely see the baked material in rendered mode or your own custom mode with rendered materials. If you are on shaded or ghosted etc you’ll be seeing the layer color -not the Material color the curves were baked with. Just use Custom Preview.