Problem in baking via python code

Hi ,

I am new to coding via python , and I am facing a problem that the node failed to bake the geometry , although no errors showing in the IDE window , any advise .

regards
python tutorials _color cubes.gh (6.9 KB)

Note lines 36 and 42 that I added to your code:


You will also need to add the line import Rhino at the top of your code.

See tutorial here for further info:

-Kevin

2 Likes

This was done with Python:

http://www.islandcad.com/grasshopper/bake_to_layer/

1 Like

@kev.r

thanks your comment has worked .
actually there is something strange , because I followed this code from tutorial , and he is doing it the same code I attached and even baking objects with colors , if you don’t mind can you have look at
Learn Python for Grasshopper - Full Course for Beginners - Free - YouTube at (function and baking part ) .

thanks again for your help

You have created geometry and attributes, but they are not associated with each other.

Change line 41 to:

        sc.doc.Objects.AddBrep(brep, attr)

-Kevin

1 Like

got it , thanks