Skip to content

Scripting API

Describe

from ArtisanPlugin.Scripting import ViewApi as view

Describe prints the three vocabularies every other method on this facade takes as strings: the open viewports, the named views saved in the document, and the display modes Rhino has installed. In a headless or batch run you cannot see the Rhino window, so this is how you find out what viewport = "Top", RestoreNamedView("Hero") or SetDisplayMode("Arctic") are allowed to say on this machine and this document.

Usage

print(view.Describe())

It takes no parameters.

It returns a string - three lines, in this order, joined by newlines:

Viewports: Perspective (active), Top, Front, Right
Named views: Hero, Side, Detail
Display modes: Wireframe, Shaded, Rendered, Ghosted, X-Ray, Technical, Artistic, Pen, Arctic, Raytraced

Each list is comma-separated. The viewport that is currently active carries the suffix " (active)" - that is the one every other method drives when you leave viewport at null. When the document has no named views the second line reads Named views: (none); the other two lines are never empty in a running Rhino. Parse it by splitting on newlines and then on ", ", but treat it as a human-readable report first: it exists so a batch log shows what the script was working with.

Two things are deliberately absent. Layout (page) viewports are excluded - the list comes from Rhino’s standard model views only - so a layout detail cannot be named as a viewport anywhere in this facade. And display-mode names are the English names, regardless of the language the Rhino UI is running in; that is what SetDisplayMode matches against.

Describe is read-only. It changes nothing in the document and nothing in the view, so it needs no Transaction and no licence: it is the one method here you can call freely to probe the environment. It is also the only method that does not throw when there is no document open - it returns an empty string instead, which is a useful check before a batch loop starts.