Rhino.Render with ghPython and RhinoCommon

I’m generating geometry and materials in ghPython. I can create a preview with the Custom Preview component and then render running the command. manually.

I want to render from within ghPython using rhinoCommon so that I can iterate through multiple variations of my geometry and materials and batch render. I eventually want to do batch renders of turntable animations. I don’t need help with looping and iterating. I’ve got that working out fine.

Anyone have any example code or pseudo code for using Rhino.Render? I’m leaning towards .AsyncRenderContext since I will need to wait for the render to finish before I can save the file and continue through the rest of the for loop. Do I need to set other bits up before I can render?

You can script the _Render command and then script also saving of the result using _SaveRenderWindowAs.

Thanks for the quick reply Nathan.

What library are _Render and _SaveRenderWindowAs in?

I’ve been working with the RhinoCommon API

Do you have links to developer documentation that you’re referencing or can you provide a snippet of code to make this more clear?

You’d be using RhinoApp.RunScript Method (String, Boolean)

_Render and _SaveRenderWindowAs are regular Rhino commands you can type in the command-line.