.NET API
ViewApi
Rhino VIEWPORT control for batch rendering: point the camera, restore named views, switch display modes and capture the frame to a file. (The Realtime Render viewer has its own camera — see RealtimeRenderApi. This facade drives the Rhino viewports themselves.) None of this modifies the document’s geometry; camera moves are license-free, capturing a file is gated like the other exports.
from ArtisanPlugin.Scripting import ViewApi
See also the guide, Views › Capture, and the Python package, ra.view.
Methods
| Method | |
|---|---|
Capture | Captures viewport (null = the active one) to a PNG at the given pixel size (0 = the viewport’s current size). |
Describe | The open viewports, the saved named views and the available display modes — the vocabularies the other methods accept. |
ImportNamedViews | Imports the named views saved in another 3dm file into the active document — the way to give every document of a batch run the same standard camera angles: keep them once in a template 3dm, import, then RestoreNamedView + Capture per angle. |
RestoreNamedView | Restores a saved named view onto viewport (null = the active one). |
SaveNamedView | Saves (or overwrites) the current camera of viewport as a named view — the building block for reusable batch-render angles. |
SetCamera | Places the camera of viewport (null = the active one) at location looking at target, in perspective projection. |
SetDisplayMode | Switches the display mode of viewport (null = the active one). |
ZoomExtents | Zooms viewport (null = the active one) to the extents of the visible geometry. |
Capture
string ViewApi.Capture(string path, int width = 0, int height = 0, string viewport = null)
Captures viewport (null = the active one) to a PNG at the given pixel size (0 = the viewport’s current size). Returns the full path written (“.png” appended when missing; folders are created).
| Parameter | Type | Default |
|---|---|---|
path | string | required |
width | int | 0 |
height | int | 0 |
viewport | string | null |
Returns string.
Describe
string ViewApi.Describe()
The open viewports, the saved named views and the available display modes — the vocabularies the other methods accept.
Returns string.
ImportNamedViews
IReadOnlyList<string> ViewApi.ImportNamedViews(string path)
Imports the named views saved in another 3dm file into the active document — the way to give every document of a batch run the same standard camera angles: keep them once in a template 3dm, import, then RestoreNamedView + Capture per angle. A view whose name already exists in the document is skipped (the document’s own view wins). Returns the names imported.
| Parameter | Type | Default |
|---|---|---|
path | string | required |
Returns IReadOnlyList<string>.
RestoreNamedView
void ViewApi.RestoreNamedView(string name, string viewport = null)
Restores a saved named view onto viewport (null = the active one). The names come from Describe().
| Parameter | Type | Default |
|---|---|---|
name | string | required |
viewport | string | null |
SaveNamedView
void ViewApi.SaveNamedView(string name, string viewport = null)
Saves (or overwrites) the current camera of viewport as a named view — the building block for reusable batch-render angles.
| Parameter | Type | Default |
|---|---|---|
name | string | required |
viewport | string | null |
SetCamera
void ViewApi.SetCamera(
Point3d location,
Point3d target,
double lensMm = 0,
string viewport = null)
Places the camera of viewport (null = the active one) at location looking at target, in perspective projection. lensMm > 0 also sets the 35mm-equivalent lens length (50 is a natural product shot, 85-100 flattens like a macro lens).
| Parameter | Type | Default |
|---|---|---|
location | Point3d | required |
target | Point3d | required |
lensMm | double | 0 |
viewport | string | null |
SetDisplayMode
void ViewApi.SetDisplayMode(string mode, string viewport = null)
Switches the display mode of viewport (null = the active one). Mode names come from Describe() — e.g. Wireframe, Shaded, Rendered, Raytraced, Arctic, Pen.
| Parameter | Type | Default |
|---|---|---|
mode | string | required |
viewport | string | null |
ZoomExtents
void ViewApi.ZoomExtents(string viewport = null)
Zooms viewport (null = the active one) to the extents of the visible geometry.
| Parameter | Type | Default |
|---|---|---|
viewport | string | null |