Scripting API
Display mode
from ArtisanPlugin.Scripting import ViewApi as view
SetDisplayMode switches what a viewport draws: wireframe for a quick geometry check, Rendered for a presentable capture, Raytraced when you want Cycles to do the work. In a batch run it is the step between pointing the camera and capturing the frame - the same document captured in Shaded and in Rendered gives you a technical image and a sales image from one pass.
Usage
view.SetDisplayMode(mode, viewport = None)
| Parameter | Default | Meaning |
|---|---|---|
mode | - | Display mode name, in English (see below) |
viewport | None | Viewport to switch; None means the active one |
The accepted vocabulary
The accepted names are exactly the English names of the display modes installed in this Rhino, which is what the third line of Describe() prints. On a stock Rhino that includes Wireframe, Shaded, Rendered, Ghosted, X-Ray, Technical, Artistic, Pen, Arctic and Raytraced, but the list is not fixed: custom modes the user or a plugin has added are equally valid, and a mode someone deleted is not. Read Describe() rather than hard-coding the list if your script has to run on machines you do not control.
Matching is case-insensitive and the name is trimmed, so "rendered", "Rendered" and " Rendered " all work. It is not fuzzy beyond that: the English name must match in full, so the localised name shown in a Spanish or German Rhino UI will not be found.
An empty or whitespace mode throws ArgumentException with "A display mode name is required.". Anything else that does not match throws ArgumentException, and the message enumerates the real modes so a failing batch log tells you what to use instead:
Unknown display mode 'Render'. Modes: Wireframe, Shaded, Rendered, Ghosted, X-Ray, Technical, Artistic, Pen, Arctic, Raytraced.
What it changes
Returns void. It sets the viewport’s display mode and redraws. This is a view change only - no object, layer or setting in the document is touched, the document is not marked modified, so no Transaction is required and no licence is checked.
One practical caution: Raytraced starts an asynchronous Cycles render that refines over time. The call returns as soon as the mode is set, not when the image has converged, so a Capture fired immediately afterwards will record a noisy early pass. For clean raytraced output, give it time to settle before capturing, or use the Realtime Render facade instead - see Render.