How to bake and prepare for export with materials

I’ve created a Grasshopper file for a cabinet which I now want to export into OBJ with different materials for the sides, doors and shelves.

Is there a way to automatically assign/generate different materials for different geometry? Let’s say I’ve got this simple Grasshopper design:

How would I be able to set a different material for each of the rectangles? (4.1 KB)

Curve objects do not have material.

For other kind of geometries you can do this with normal grasshopper:

Note that if you bake the “Custom Preview” it will bake the geometries with pre-assigned material.

If you want to bake curves with color or have deeper control you’ll have to go through scripting or use some plugin (Elefront, maybe).

Thanks @maje90 this is exactly what I was looking for.