.NET API
RealtimeRenderApi
Realtime Render (the web-based viewer): open the window, push model updates, and drive the VIEWER’s camera and materials by injecting JS against the web component’s public methods through the window’s WebView2. Everything here changes only the viewer, never the Rhino document — for document-side render staging (pairs, materials, batch renders) see RenderApi; for Rhino/Cycles see RenderStudioApi.
from ArtisanPlugin.Scripting import RealtimeRenderApi
See also the guide, Realtime Render, and the Python package, ra.realtime_render.
Methods
| Method | |
|---|---|
CaptureViews | Captures the 8 standard orbital views (front, back, left, right, three-quarter x2, top, bottom) as PNGs into folder — one call, camera restored afterwards. |
EditViewerMaterial | Live-edits a catalog material everywhere it is currently applied: color (CSS color), roughness 0-1, ior (gems, ~1.4-2.4), opacity 0-1. |
GetViewerItems | JSON array with the viewer’s parts and their current materials ([{uuid, material, …}]). |
RecordTurntable | One-call 360: turns auto-rotation on, records seconds of video to path, and schedules the rotation back off inside the page when the recording ends — the script needs no sleeps or timers. |
SetMaterialByLayer | Applies a viewer catalog material to every part on a layer. |
SetViewerBackground | Sets the viewer’s background gradient. |
SetViewerCamera | Places the VIEWER camera at position looking at target (viewer/GLB coordinates, which match the Rhino model in mm). |
SetViewerCameraPreset | Moves the VIEWER camera to a named preset. |
SetViewerEnvironment | Sets the lighting environment: a preset name (studio, sunset, dawn, night, warehouse, forest, apartment, city, park, lobby) or an HDR/EXR URL. |
SetViewerMaterial | Changes one part’s material in the viewer. |
SetViewerOption | Sets ANY single viewer option by its dot-path key — backgrounds, bevel, jewelry shadows, AO, depth of field, bloom, vignette, caustics, studio lights, autoRotate… |
SetViewerOptions | Applies a batch of viewer options in one call. |
ShowRealtimeRender | Opens the Realtime Render window (or activates it when already open), same as the ArtisanRealtimeRender command — which is hidden from the command list, so this is the only scriptable way in. |
StartVideoRecording | Starts recording the viewer to a video file. |
StopVideoRecording | Stops a manual recording started with seconds = 0; the file is then written to the path given to StartVideoRecording. |
UpdateRender | Re-exports the current document to the viewer (the ArtisanRenderUpdate command). |
ViewerScreenshot | Saves a PNG of the current viewer frame to path and returns the full path written (“.png” appended when missing). |
ViewerZoomExtents | Frames the whole model in the viewer. |
CaptureViews
string RealtimeRenderApi.CaptureViews(string folder, int width = 0, int height = 0)
Captures the 8 standard orbital views (front, back, left, right, three-quarter x2, top, bottom) as PNGs into folder — one call, camera restored afterwards. Returns the paths written, one per line. Slow: expect a few seconds; the call waits up to 2 minutes.
| Parameter | Type | Default |
|---|---|---|
folder | string | required |
width | int | 0 |
height | int | 0 |
Returns string.
EditViewerMaterial
void RealtimeRenderApi.EditViewerMaterial(
string materialName,
string color = null,
double roughness = -1,
double ior = -1,
double opacity = -1)
Live-edits a catalog material everywhere it is currently applied: color (CSS color), roughness 0-1, ior (gems, ~1.4-2.4), opacity 0-1. Pass null/negative to leave a property untouched. The edit is ephemeral — re-applying the material from the catalog resets it.
| Parameter | Type | Default |
|---|---|---|
materialName | string | required |
color | string | null |
roughness | double | -1 |
ior | double | -1 |
opacity | double | -1 |
GetViewerItems
string RealtimeRenderApi.GetViewerItems()
JSON array with the viewer’s parts and their current materials ([{uuid, material, …}]). Call this FIRST to learn the part names (uuids) to pass to SetViewerMaterial.
Returns string.
RecordTurntable
string RealtimeRenderApi.RecordTurntable(
string path,
double seconds = 8,
int width = 0,
int height = 0,
int frameRate = 0)
One-call 360: turns auto-rotation on, records seconds of video to path, and schedules the rotation back off inside the page when the recording ends — the script needs no sleeps or timers. Returns the path armed; the file appears when the recording finishes.
| Parameter | Type | Default |
|---|---|---|
path | string | required |
seconds | double | 8 |
width | int | 0 |
height | int | 0 |
frameRate | int | 0 |
Returns string.
SetMaterialByLayer
int RealtimeRenderApi.SetMaterialByLayer(string layerName, string materialName)
Applies a viewer catalog material to every part on a layer. layerName matches the viewer item’s layer or name, case-insensitive and treating spaces and underscores as equal — so “METAL_01”, “metal 01” and “Metal 01” all hit the Rhino layer “Metal 01”. Returns how many parts changed; throws listing the available layers when nothing matches. Viewer-only: the Rhino document is untouched.
| Parameter | Type | Default |
|---|---|---|
layerName | string | required |
materialName | string | required |
Returns int.
SetViewerBackground
void RealtimeRenderApi.SetViewerBackground(string topColor, string bottomColor = null)
Sets the viewer’s background gradient. Colors are CSS colors (“#1a1a2e”, “white”…). Pass null/empty to leave one end unchanged.
| Parameter | Type | Default |
|---|---|---|
topColor | string | required |
bottomColor | string | null |
SetViewerCamera
void RealtimeRenderApi.SetViewerCamera(Point3d position, Point3d target)
Places the VIEWER camera at position looking at target (viewer/GLB coordinates, which match the Rhino model in mm).
| Parameter | Type | Default |
|---|---|---|
position | Point3d | required |
target | Point3d | required |
SetViewerCameraPreset
void RealtimeRenderApi.SetViewerCameraPreset(string preset)
Moves the VIEWER camera to a named preset. Valid presets: front, back, left, right, top, bottom, three-quarter, three-quarter-left, detail, dramatic-low. The preset frames the model automatically.
| Parameter | Type | Default |
|---|---|---|
preset | string | required |
SetViewerEnvironment
void RealtimeRenderApi.SetViewerEnvironment(string presetOrUrl, double intensity = 0)
Sets the lighting environment: a preset name (studio, sunset, dawn, night, warehouse, forest, apartment, city, park, lobby) or an HDR/EXR URL. intensity > 0 also sets the environment intensity (1 = neutral).
| Parameter | Type | Default |
|---|---|---|
presetOrUrl | string | required |
intensity | double | 0 |
SetViewerMaterial
void RealtimeRenderApi.SetViewerMaterial(string partUuid, string materialName)
Changes one part’s material in the viewer. partUuid comes from GetViewerItems(); materialName is a viewer catalog name (e.g. “YELLOW_GOLD”, “WHITE_GOLD”, “PLATINUM”, “DIAMOND”, “RUBY”). Viewer-only: the Rhino document is not modified.
| Parameter | Type | Default |
|---|---|---|
partUuid | string | required |
materialName | string | required |
SetViewerOption
void RealtimeRenderApi.SetViewerOption(string path, string value)
Sets ANY single viewer option by its dot-path key — backgrounds, bevel, jewelry shadows, AO, depth of field, bloom, vignette, caustics, studio lights, autoRotate… value is parsed as bool, number or string (“true”, “0.4”, “#ffffff”).
| Parameter | Type | Default |
|---|---|---|
path | string | required |
value | string | required |
SetViewerOptions
void RealtimeRenderApi.SetViewerOptions(string optionsJson)
Applies a batch of viewer options in one call. optionsJson is a JSON object of option keys to values, e.g. {“effectComposerBloomEnabled”:true,“effectComposerBloomIntensity”:0.6}.
| Parameter | Type | Default |
|---|---|---|
optionsJson | string | required |
ShowRealtimeRender
bool RealtimeRenderApi.ShowRealtimeRender()
Opens the Realtime Render window (or activates it when already open), same as the ArtisanRealtimeRender command — which is hidden from the command list, so this is the only scriptable way in.
Returns bool.
StartVideoRecording
string RealtimeRenderApi.StartVideoRecording(
string path,
double seconds = 0,
int width = 0,
int height = 0,
int frameRate = 0)
Starts recording the viewer to a video file. seconds > 0 stops and saves automatically after that long; 0 records until StopVideoRecording(). The finished file lands at path (the window reroutes the viewer’s download there). The viewer picks the codec: mp4 (h264) when the OS supports it, webm otherwise — keep “.mp4”.
| Parameter | Type | Default |
|---|---|---|
path | string | required |
seconds | double | 0 |
width | int | 0 |
height | int | 0 |
frameRate | int | 0 |
Returns string.
StopVideoRecording
void RealtimeRenderApi.StopVideoRecording()
Stops a manual recording started with seconds = 0; the file is then written to the path given to StartVideoRecording. Saving is asynchronous — give it a moment before reading the file.
UpdateRender
void RealtimeRenderApi.UpdateRender()
Re-exports the current document to the viewer (the ArtisanRenderUpdate command). The export runs in the background; this returns as soon as it is queued. Requires the Realtime Render window to be open — throws a clear error otherwise (the command only logged it, which a script would never see).
ViewerScreenshot
string RealtimeRenderApi.ViewerScreenshot(string path)
Saves a PNG of the current viewer frame to path and returns the full path written (“.png” appended when missing).
| Parameter | Type | Default |
|---|---|---|
path | string | required |
Returns string.
ViewerZoomExtents
void RealtimeRenderApi.ViewerZoomExtents()
Frames the whole model in the viewer.