Render to image file

Hi all,

I need to do several renderings of current view to image files. How can i do this ?

The _Render command seems not allowing parameters. Maybe i didn’t look good enough.
Parameters i need is : HorizontalSizePixels, VerticalSizePixels, FilePathAndName
All other parameters will be kept as setted by user.

Can someone help me for doing this ? :wink:

Note : I have already done some renderings by rendering the Viewport using “ViewCaptureToFile”.
But this is not what i need.

All the best,


To set the render size (HorizontalSizePixels, VerticalSizePixels), script the ViewportProperties command. For example:

_-SetActiveViewport _Perspective"
_-ViewportProperties _Size 800 400 _Enter"

To save a rendering, use the SaveRenderWindowAs command.

Does this help?

Thanks for your answer Dale.

I have tried this:

#define UseRenderer
#ifdef UseRenderer
    CString cmd = L"_-SetActiveViewport Perspective _Enter";

    wsprintf(r, L"%d", resolution);
    cmd = L"_-ViewportProperties _Size ";
    cmd += r;
    cmd += L" ";
    cmd += r;
    cmd += L" _Enter";

    cmd = L"_-Render _Enter";

    cmd = L"_-SaveRenderWindowAs " + imageFilePath + L" _Enter";
    returnValue = RhinoApp().RunScript(cmd);

It seem’s to do what i want but the -Render call doesn’t work.
When i enter "
-Render" in command line it works…but when i call it in the above sequence it doesn’t.
Even if i just call this here it doesn’t work:

cmd = L"_-Render _Enter";

Do you have an idea why ?

Does this help?

Yes. Thanks :wink:

Deriving from CRhinoScriptCommand was the solution.