Skip to content

.NET API

DocumentApi

Document-level Artisan settings, starting with the computation mode (the Rendering/Manufacturing switch at the top of the Outliner).

from ArtisanPlugin.Scripting import DocumentApi

See also the guide, API Reference › Document, and the Python package, ra.document.

Methods

Method
GetComputationModeCurrent computation mode as a string (“Render” or “Manufacturing”).
GetMetalsThe document’s metals by position, honoring how many the document uses (1, 2 or 3 entries).
GetPathFull path of the active document, or empty for an unsaved document.
GetRingSizeThe document’s current finger size, or null when the document has no ring size (non-ring designs).
GlbExports the whole document to a GLB file (the same conversion the Realtime Render pipeline uses).
GlbBatchConverts every .3dm in folder (and its subfolders when recursive) to a GLB next to it, with the same conversion as Glb() — the configurator’s batch export (ArtisanConfFolderToGlb) without touching the open document: each file is read on its own, in the background.
IsModifiedTrue when the active document has unsaved changes.
NewCreates a new document, replacing the active one — like File > New, but without the template picker: template is a .3dm template file path, or null for Rhino’s default template.
OpenOpens a 3dm file.
RefreshAllRegenerates the parametric objects, exactly like the Outliner’s Refresh button: by default only the ones flagged as pending (RequireRegenerate — e.g.
ReportPdfExports a layout page to a 300-dpi PDF (vector where possible).
RingSizeRegionsThe available sizing regions (“EU”, “US”, …) for SetRingSize.
SaveSaves the active document.
SaveCopySaves a COPY of the active document to path (File > SaveCopyAs): the document keeps its own path and modified state, you keep working in the original file — checkpoints and versioning from a flow.
SetComputationModeSwitches the computation mode, exactly like the Outliner’s Rendering/Manufacturing selector: when the mode actually changes, every parametric object is REGENERATED at the new quality (a long operation on heavy documents).
SetMetalSets a document metal, exactly like the Outliner’s metal selector: the change re-applies the metal materials on the layers.
SetRingSizeChanges the ring’s finger size, exactly like the Outliner’s size selector: the parametric ring geometry is UPDATED to the new size and every object refreshed (long on heavy documents).
SetRingSizeByDiameterSame, but from an inner diameter in mm — resolves to the nearest catalog size of region (omitted = the document’s current region).
StlExports geometry to a binary STL for 3D printing: everything visible, or only the current selection with onlySelection.

GetComputationMode

string DocumentApi.GetComputationMode()

Current computation mode as a string (“Render” or “Manufacturing”).

Returns string.

GetMetals

IReadOnlyList<string> DocumentApi.GetMetals()

The document’s metals by position, honoring how many the document uses (1, 2 or 3 entries).

Returns IReadOnlyList<string>.

GetPath

string DocumentApi.GetPath()

Full path of the active document, or empty for an unsaved document.

Returns string.

GetRingSize

RingSizeInfo DocumentApi.GetRingSize()

The document’s current finger size, or null when the document has no ring size (non-ring designs).

Returns RingSizeInfo.

Glb

string DocumentApi.Glb(string path)

Exports the whole document to a GLB file (the same conversion the Realtime Render pipeline uses).

ParameterTypeDefault
pathstringrequired

Returns string.

GlbBatch

IReadOnlyList<GlbBatchItem> DocumentApi.GlbBatch(
    string folder,
    bool recursive = true,
    bool overwrite = false)

Converts every .3dm in folder (and its subfolders when recursive) to a GLB next to it, with the same conversion as Glb() — the configurator’s batch export (ArtisanConfFolderToGlb) without touching the open document: each file is read on its own, in the background. GLBs already there are kept unless overwrite. Returns one row per file.

ParameterTypeDefault
folderstringrequired
recursivebooltrue
overwriteboolfalse

Returns IReadOnlyList<GlbBatchItem>.

IsModified

bool DocumentApi.IsModified()

True when the active document has unsaved changes.

Returns bool.

New

void DocumentApi.New(string template = null, bool discardChanges = false)

Creates a new document, replacing the active one — like File > New, but without the template picker: template is a .3dm template file path, or null for Rhino’s default template. Fails on unsaved changes unless discardChanges is true.

ParameterTypeDefault
templatestringnull
discardChangesboolfalse

Open

string DocumentApi.Open(string path, bool discardChanges = false)

Opens a 3dm file. The active document is replaced, like File > Open. Fails when the current document has unsaved changes, unless discardChanges is true (there is never a save prompt). Returns the full path opened.

ParameterTypeDefault
pathstringrequired
discardChangesboolfalse

Returns string.

RefreshAll

void DocumentApi.RefreshAll(bool force = false)

Regenerates the parametric objects, exactly like the Outliner’s Refresh button: by default only the ones flagged as pending (RequireRegenerate — e.g. children whose mother moved); force true regenerates EVERYTHING (the button’s double-click), a long operation on heavy documents.

ParameterTypeDefault
forceboolfalse

ReportPdf

string DocumentApi.ReportPdf(string path, string pageName = "Template")

Exports a layout page to a 300-dpi PDF (vector where possible). pageName defaults to “Template” — the layout the report-template tools produce. Throws listing the available layouts when the page doesn’t exist (the underlying service only logged it).

ParameterTypeDefault
pathstringrequired
pageNamestring"Template"

Returns string.

RingSizeRegions

IReadOnlyList<string> DocumentApi.RingSizeRegions()

The available sizing regions (“EU”, “US”, …) for SetRingSize.

Returns IReadOnlyList<string>.

Save

string DocumentApi.Save(string path = null)

Saves the active document. With path it saves a copy there and the document adopts that path (File > Save As); without it the document must already have a path. Returns the full path written.

ParameterTypeDefault
pathstringnull

Returns string.

SaveCopy

string DocumentApi.SaveCopy(string path)

Saves a COPY of the active document to path (File > SaveCopyAs): the document keeps its own path and modified state, you keep working in the original file — checkpoints and versioning from a flow. Returns the full path written.

ParameterTypeDefault
pathstringrequired

Returns string.

SetComputationMode

void DocumentApi.SetComputationMode(string mode)

Switches the computation mode, exactly like the Outliner’s Rendering/Manufacturing selector: when the mode actually changes, every parametric object is REGENERATED at the new quality (a long operation on heavy documents). “Render” = smooth display quality; “Manufacturing” = production-accurate geometry.

ParameterTypeDefault
modestringrequired

SetMetal

void DocumentApi.SetMetal(string metal, int position = 0)

Sets a document metal, exactly like the Outliner’s metal selector: the change re-applies the metal materials on the layers. metal Metal enum name (“GOLD_YELLOW_18”, “PLATINUM”, … — see WeightApi.Metals()) position 0 (default) = the WHOLE document uses this metal (single-metal mode); 1, 2 or 3 = that metal position (using different metals per position turns the document into a 2- or 3-metal design, as in the Outliner).

ParameterTypeDefault
metalstringrequired
positionint0

SetRingSize

void DocumentApi.SetRingSize(string region, string size)

Changes the ring’s finger size, exactly like the Outliner’s size selector: the parametric ring geometry is UPDATED to the new size and every object refreshed (long on heavy documents). region accepts the catalog ids (“USA”, “EUROPE”, “BRITISH”, …) and the common short aliases (“US”, “EU”, “UK”, …). Only valid on ring designs with a current size.

ParameterTypeDefault
regionstringrequired
sizestringrequired

SetRingSizeByDiameter

void DocumentApi.SetRingSizeByDiameter(double diameter, string region = null)

Same, but from an inner diameter in mm — resolves to the nearest catalog size of region (omitted = the document’s current region).

ParameterTypeDefault
diameterdoublerequired
regionstringnull

Stl

string DocumentApi.Stl(string path, bool onlySelection = false)

Exports geometry to a binary STL for 3D printing: everything visible, or only the current selection with onlySelection. Runs Rhino’s native STL exporter with its default meshing parameters.

ParameterTypeDefault
pathstringrequired
onlySelectionboolfalse

Returns string.