.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 | |
|---|---|
GetComputationMode | Current computation mode as a string (“Render” or “Manufacturing”). |
GetMetals | The document’s metals by position, honoring how many the document uses (1, 2 or 3 entries). |
GetPath | Full path of the active document, or empty for an unsaved document. |
GetRingSize | The document’s current finger size, or null when the document has no ring size (non-ring designs). |
Glb | Exports the whole document to a GLB file (the same conversion the Realtime Render pipeline uses). |
GlbBatch | 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. |
IsModified | True when the active document has unsaved changes. |
New | 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. |
Open | Opens a 3dm file. |
RefreshAll | Regenerates the parametric objects, exactly like the Outliner’s Refresh button: by default only the ones flagged as pending (RequireRegenerate — e.g. |
ReportPdf | Exports a layout page to a 300-dpi PDF (vector where possible). |
RingSizeRegions | The available sizing regions (“EU”, “US”, …) for SetRingSize. |
Save | Saves the active document. |
SaveCopy | 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. |
SetComputationMode | 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). |
SetMetal | Sets a document metal, exactly like the Outliner’s metal selector: the change re-applies the metal materials on the layers. |
SetRingSize | 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). |
SetRingSizeByDiameter | Same, but from an inner diameter in mm — resolves to the nearest catalog size of region (omitted = the document’s current region). |
Stl | Exports 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).
| Parameter | Type | Default |
|---|---|---|
path | string | required |
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.
| Parameter | Type | Default |
|---|---|---|
folder | string | required |
recursive | bool | true |
overwrite | bool | false |
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.
| Parameter | Type | Default |
|---|---|---|
template | string | null |
discardChanges | bool | false |
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.
| Parameter | Type | Default |
|---|---|---|
path | string | required |
discardChanges | bool | false |
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.
| Parameter | Type | Default |
|---|---|---|
force | bool | false |
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).
| Parameter | Type | Default |
|---|---|---|
path | string | required |
pageName | string | "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.
| Parameter | Type | Default |
|---|---|---|
path | string | null |
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.
| Parameter | Type | Default |
|---|---|---|
path | string | required |
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.
| Parameter | Type | Default |
|---|---|---|
mode | string | required |
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).
| Parameter | Type | Default |
|---|---|---|
metal | string | required |
position | int | 0 |
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.
| Parameter | Type | Default |
|---|---|---|
region | string | required |
size | string | required |
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).
| Parameter | Type | Default |
|---|---|---|
diameter | double | required |
region | string | null |
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.
| Parameter | Type | Default |
|---|---|---|
path | string | required |
onlySelection | bool | false |
Returns string.