Render and save results in RhinoCommon

Hi,
I would like to code a component to render automatically via grasshopper. I’m aware that this is quite a complex topic including:

  • putting geometry from Grasshopper to Rhino document (the way Selectable Preview works).
  • Appling materials (optional).
  • Asking Rhino to render (key part).
  • Waiting for render finish and saving incrementally the results.
  • Deleting geometry in rhino document and telling grasshopper to continue (repeat).

Is there a way to achieve it? Or even better already done before?

Thanks in advance.

In principle you can try the following:

Use this preview component and preview meshes will be rendered
image

image

You can call “Render” as a command via the Rhino.RhinoApp.RunScript() method.
Wrap the call in an event handler listening to this, so that when the GH script finishes, the render command is fired. Remember to also call “CloseRenderWindow” after each cycle.