.NET API
Core types
Transaction
Lets a script group multiple mutating calls into a single undo step — otherwise every Move/Delete/Create fires its own Views.Redraw and lands as a separate undo entry, polluting the user’s history. From Python: from ArtisanPlugin.Scripting import Transaction with Transaction.Begin(“Move all gems”): for g in gem.All(): g.Move(…) The “with” block guarantees the record is closed even on exception, which is critical because a leaked undo record corrupts the doc’s history for the rest of the session.
| Member | |
|---|---|
IDisposable Transaction.Begin(string description) |
ScriptingInfo
Version and status of the scripting API, independent of the plugin version. Scripts can branch on it (if ScriptingInfo.ApiVersion < ...) and support can ask for it. Bumped by hand together with docs/CHANGELOG-API.md (semantic versioning: MAJOR for removals or behaviour changes, MINOR for additions, PATCH for fixes). While the major version is 0 the API is in beta: names may still change, but never without an [Obsolete] alias kept for at least six months, which is what the public docs promise.
LicenseGate
Central choke-point for license enforcement on the scripting facade. Every public mutating call in the scripting API must go through one of these before touching anything in the kernel or the Rhino document.
| Member | |
|---|---|
void LicenseGate.RequireTier(string tier) | Hook reserved for tier-based features later (e.g. Pro/Enterprise-only commands). Today this is a no-op beyond the validity check; we’ll specialize it as soon as the license layer exposes tier info we can branch on. |
void LicenseGate.RequireValid() | Always required: a valid RhinoArtisan license must exist for any scripted operation. Runs the SAME authoritative validation the commands run (ShapesPlugin.ValidateLicense, which caches internally with a TTL and fails closed), so a license expiring mid-session blocks scripts exactly like it blocks commands. Falls back to the kernel’s last-known status only if the plugin instance isn’t available. |
Exceptions
| Exception | Base | When |
|---|---|---|
ScriptingComputeException | ArgumentException | The arguments were accepted but the kernel could not build the geometry with them (a profile that cannot be swept, a shank too thin for its gems, sections that overlap). is the kernel’s error key when there is one, e.g. INVALID_PROFILE; the message is its translation in the UI language followed by the key in parentheses, so a script can match on either. |
ScriptingNotLicensedException | ArgumentException | The call needs a valid RhinoArtisan license and there is none. Read-only queries never throw this. |
ScriptingStateException | InvalidOperationException | The document is not in a state where the call makes sense: no active document, the object no longer exists, the handle points at an object of another kind, nothing is selected. |
ScriptingValidationException | ArgumentException | An argument was rejected before anything was computed: wrong enum name, value out of range, unknown id, malformed JSON. The message names the parameter and, where there is a closed set, the valid values. |