Skip to content

.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
CaptureViewsCaptures the 8 standard orbital views (front, back, left, right, three-quarter x2, top, bottom) as PNGs into folder — one call, camera restored afterwards.
EditViewerMaterialLive-edits a catalog material everywhere it is currently applied: color (CSS color), roughness 0-1, ior (gems, ~1.4-2.4), opacity 0-1.
GetViewerItemsJSON array with the viewer’s parts and their current materials ([{uuid, material, …}]).
RecordTurntableOne-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.
SetMaterialByLayerApplies a viewer catalog material to every part on a layer.
SetViewerBackgroundSets the viewer’s background gradient.
SetViewerCameraPlaces the VIEWER camera at position looking at target (viewer/GLB coordinates, which match the Rhino model in mm).
SetViewerCameraPresetMoves the VIEWER camera to a named preset.
SetViewerEnvironmentSets the lighting environment: a preset name (studio, sunset, dawn, night, warehouse, forest, apartment, city, park, lobby) or an HDR/EXR URL.
SetViewerMaterialChanges one part’s material in the viewer.
SetViewerOptionSets ANY single viewer option by its dot-path key — backgrounds, bevel, jewelry shadows, AO, depth of field, bloom, vignette, caustics, studio lights, autoRotate…
SetViewerOptionsApplies a batch of viewer options in one call.
ShowRealtimeRenderOpens 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.
StartVideoRecordingStarts recording the viewer to a video file.
StopVideoRecordingStops a manual recording started with seconds = 0; the file is then written to the path given to StartVideoRecording.
UpdateRenderRe-exports the current document to the viewer (the ArtisanRenderUpdate command).
ViewerScreenshotSaves a PNG of the current viewer frame to path and returns the full path written (“.png” appended when missing).
ViewerZoomExtentsFrames 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.

ParameterTypeDefault
folderstringrequired
widthint0
heightint0

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.

ParameterTypeDefault
materialNamestringrequired
colorstringnull
roughnessdouble-1
iordouble-1
opacitydouble-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.

ParameterTypeDefault
pathstringrequired
secondsdouble8
widthint0
heightint0
frameRateint0

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.

ParameterTypeDefault
layerNamestringrequired
materialNamestringrequired

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.

ParameterTypeDefault
topColorstringrequired
bottomColorstringnull

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).

ParameterTypeDefault
positionPoint3drequired
targetPoint3drequired

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.

ParameterTypeDefault
presetstringrequired

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).

ParameterTypeDefault
presetOrUrlstringrequired
intensitydouble0

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.

ParameterTypeDefault
partUuidstringrequired
materialNamestringrequired

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”).

ParameterTypeDefault
pathstringrequired
valuestringrequired

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}.

ParameterTypeDefault
optionsJsonstringrequired

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”.

ParameterTypeDefault
pathstringrequired
secondsdouble0
widthint0
heightint0
frameRateint0

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).

ParameterTypeDefault
pathstringrequired

Returns string.

ViewerZoomExtents

void RealtimeRenderApi.ViewerZoomExtents()

Frames the whole model in the viewer.