I want to render my viewport with C# and automatically save the result to a specify directory. How would I be able to do that, I couldn’t find a proper guide to that. I managed to set a custom environment, render settings in C#, just how to render is missing.
The easiest way to accomplish what you are asking, is to just execute a Rhino Script to perform the render and then save the render window. Similar to this:
var savePath = Path.Combine(folder, $"{filename}.png");
RhinoApp.RunScript($@"!_Render _-SaveRenderWindowAs ""{savePath}""", true);