.NET API
RenderApi
Document-side render staging: pairs, lying-on-ground, design/render materials and batch renders. Everything here touches the RHINO document. The web-based Realtime Render viewer has its own facade, RealtimeRenderApi; Rhino/Cycles rendering lives in RenderStudioApi.
from ArtisanPlugin.Scripting import RenderApi
See also the guide, Render, and the Python package, ra.render.
Methods
| Method | |
|---|---|
ApplyDesignMaterials | Applies the DESIGN (viewport) materials to every visible object in the active document — the ArtisanApplyDesignMaterials command, headless. |
ApplyRenderMaterials | Applies the photorealistic RENDER materials to every visible object in the active document — the ArtisanApplyRenderMaterials command, headless. |
BatchRender | Renders every .3dm file in folder (optionally recursing into sub-folders) with the current render engine — the ArtisanBatchRendering command, headless: no options dialog, no folder picker, no progress window (per-file failures come back in the result instead). |
CreatePair | Duplicates the objects as the second piece of a pair — the ArtisanPair command, headless. |
LieOnGround | Rotates the objects around the X (or Y) axis so they lie as FLAT on the ground plane as possible — the ArtisanLyingOnTheGround command, used to stage pieces for renders. |
ApplyDesignMaterials
int RenderApi.ApplyDesignMaterials()
Applies the DESIGN (viewport) materials to every visible object in the active document — the ArtisanApplyDesignMaterials command, headless. Global, like the command: no selection is taken. Gems, diamonds, pearls and cabochons get their gem material from the document material table; breps, extrusions, meshes and SubDs get the document’s Metal 1 material (the command deliberately ignores the Metal 02/03 layers on this side of the switch). Returns the number of objects visited.
Returns int.
ApplyRenderMaterials
int RenderApi.ApplyRenderMaterials()
Applies the photorealistic RENDER materials to every visible object in the active document — the ArtisanApplyRenderMaterials command, headless. Global, like the command: no selection is taken. Gems and diamonds get their gem RenderMaterial from the render catalog; pearls and cabochons the pearl material; breps, extrusions, meshes and SubDs the render metal of their LAYER (“Metal 01”/“Metal 02”/ “Metal 03” map to the document’s metal positions, anything else falls back to Metal 1). Same side effects as the command: raises the document render sampling to 25 samples and, on Rhino 8+, installs the default 2Shapes environment when none (or the stock “Studio” one) is active. Returns the number of objects visited.
Returns int.
BatchRender
BatchRenderResult RenderApi.BatchRender(
string folder,
bool includeSubfolders = false,
string extension = ".jpg",
bool customResolution = false,
int width = 1920,
int height = 1080)
Renders every .3dm file in folder (optionally recursing into sub-folders) with the current render engine — the ArtisanBatchRendering command, headless: no options dialog, no folder picker, no progress window (per-file failures come back in the result instead). Each image is saved NEXT TO its .3dm with the same base name and the given extension (“.jpg” or “.png”, the dialog’s two formats; jpg is the dialog default). When customResolution is true every file renders at width x height pixels (dialog defaults 1920 x 1080, valid 16..20000); when false each file renders at its own saved render settings. WARNING — the ACTIVE DOCUMENT CHANGES during the run: each file is opened with _-Open, replacing whatever is open, and (same as the command) the ORIGINAL DOCUMENT IS NOT RESTORED — the last rendered file stays active when this returns. Before each open the current document’s modified flag is cleared so Rhino never prompts to save, which means unsaved changes in the open document are silently discarded. Save your work before calling this.
| Parameter | Type | Default |
|---|---|---|
folder | string | required |
includeSubfolders | bool | false |
extension | string | ".jpg" |
customResolution | bool | false |
width | int | 1920 |
height | int | 1080 |
Returns BatchRenderResult.
CreatePair
IReadOnlyList<Guid> RenderApi.CreatePair(
IEnumerable<Guid> objectIds = null,
double distance = 20,
double angle = -20,
bool mirror = false)
Duplicates the objects as the second piece of a pair — the ArtisanPair command, headless. The copy is rotated angle degrees around the Z axis at the selection’s bounding-box center, moved distance mm along X, and optionally mirrored (for asymmetric designs like earrings). Defaults match the command (20 mm, -20 degrees, no mirror). objectIds null/empty = current selection. Returns the ids of the copies.
| Parameter | Type | Default |
|---|---|---|
objectIds | IEnumerable<Guid> | null |
distance | double | 20 |
angle | double | -20 |
mirror | bool | false |
Returns IReadOnlyList<Guid>.
LieOnGround
void RenderApi.LieOnGround(
IEnumerable<Guid> objectIds = null,
bool aroundX = true,
bool keepOriginal = false)
Rotates the objects around the X (or Y) axis so they lie as FLAT on the ground plane as possible — the ArtisanLyingOnTheGround command, used to stage pieces for renders. Scans rotations in 0.5-degree steps minimizing the total Z height, then picks the face-down orientation of the two candidates. keepOriginal true leaves the original in place and flattens a copy (the command’s DeleteOriginal toggle, inverted). objectIds null/empty = current selection.
| Parameter | Type | Default |
|---|---|---|
objectIds | IEnumerable<Guid> | null |
aroundX | bool | true |
keepOriginal | bool | false |