Skip to content

.NET API

DraftingApi

Documentation / drafting helpers: the report sheet and the gems map, scriptable without their interactive prompts.

from ArtisanPlugin.Scripting import DraftingApi

See also the guide, Drafting, and the Python package, ra.drafting.

Methods

Method
CreateBreakdownTableDraws one of the four Breakdown cost tables into the document at point (the ArtisanBreakdownMetals / ArtisanBreakdownGems / ArtisanBreakdownProcesses / ArtisanBreakdownExtras commands without their pick prompt).
CreateGemsMapDraws the gems map (the 2D stone chart: one colored circle + size label per gem in the document) centered at point, same as the ArtisanGemsMap command but without the pick prompt.
CreateGemsTableDraws the gems list table (the ArtisanGemsList command family) starting at point: one row per distinct gem with SHAPE, size “X x Y”, carats, quantity, total carats and compound, rows 1.5 units apart, in black.
CreateMetalsTableDraws the metals weight table (the ArtisanMetalsList / ArtisanMetalsListBySelection commands without their checklist dialog and prompts) at point: a header row (Weight / Processed) and one row per requested metal with the estimated cast weight computed from the summed volume of the measured objects — gems are skipped; Breps, extrusions, meshes and SubDs count.
CreateReportCreates the A4 report layout page for the current design (same as the ArtisanReport command): logo, four detail views (top, perspective, front, side), title block with name, metal + weight, finger size, notes and date.
CreateReportFromTemplateCreates a report from a TEMPLATE (the Report panel’s Create button, headless): imports the template’s layout as the next “Report N” page, zooms every detail, and replaces the template tags ([CLIENT_ID], [PO], [STYLE], [CAD_DESIGNER], [DESCRIPTION], metals, [PRODUCT_SIZE], custom fields…) plus the special list markers (METAL_LIST, GEM_LIST, PROCESS_LIST, EXTRA_LIST, GEM_MAP).
ExportGemsListWrites the gems list as a semicolon-delimited CSV (same columns as the ArtisanGemsListToExcel command: Shape, Size X, Size Y, Carats, Quantity, Total Carats), without the save-file dialog.
GenerateDimensionsGeneric auto-dimensioning of the design.
GenerateDimensionsByBoxBounding-box dimensions (the ArtisanGenerateDimensionsByBox command without its selection prompt): meshes the given objects together at low resolution and draws three linear dimensions around the global bounding box — width in X above the model, depth in Y at its right and the real height in Z.
GenerateDimensionsFromBangleBangle dimensions (the ArtisanGenerateDimensionsFromBangle command without its selection prompt): meshes the given objects together at low resolution, sections the mesh with the world XY / YZ planes and dimensions the four cross sections (top, bottom, left, right) plus the two global spans between them.
GenerateDimensionsFromRingRing-specific dimensions: bottom, top and size annotations built from the ring mesh and the document’s finger size.
ReportTemplatesThe report template names available to CreateReportFromTemplate — the *.3dm files in the configured report-templates folder, without extension.

CreateBreakdownTable

void DraftingApi.CreateBreakdownTable(string category, Point3d point, double scale = 0)

Draws one of the four Breakdown cost tables into the document at point (the ArtisanBreakdownMetals / ArtisanBreakdownGems / ArtisanBreakdownProcesses / ArtisanBreakdownExtras commands without their pick prompt). One method instead of four because the commands are identical except for the table they draw. category METALS | GEMS | PROCESSES | EXTRAS (case-insensitive). point insertion point (top-left corner of the table). scale layout / text-height scale factor; 0 = the tool default (2). Like the commands, when no breakdown has been computed yet (or it is empty) it is computed first from the active manufacturer — the commands ask with a yes/no dialog, here it happens silently through the same engine PricingApi.Calculate() uses. The texts are grouped as BREAKDOWN_METALS / BREAKDOWN_GEMS / BREAKDOWN_PROCESSES / BREAKDOWN_EXTRAS respectively.

ParameterTypeDefault
categorystringrequired
pointPoint3drequired
scaledouble0

CreateGemsMap

void DraftingApi.CreateGemsMap(
    Point3d point,
    double scale = 2,
    bool spherical = false,
    bool expandOverlapping = false)

Draws the gems map (the 2D stone chart: one colored circle + size label per gem in the document) centered at point, same as the ArtisanGemsMap command but without the pick prompt. scale drawing scale factor (command default 2; valid 0.01-10) spherical false = planar projection (default), true = spherical expandOverlapping true = push overlapping circles apart so every label is readable The resulting curves/texts/hatches are grouped as “GEMS_MAP”. With no gems in the document it draws nothing and reports it on the command line, same as the command.

ParameterTypeDefault
pointPoint3drequired
scaledouble2
sphericalboolfalse
expandOverlappingboolfalse

CreateGemsTable

void DraftingApi.CreateGemsTable(
    Point3d point,
    bool onlySelection = false,
    bool groupBySelection = false)

Draws the gems list table (the ArtisanGemsList command family) starting at point: one row per distinct gem with SHAPE, size “X x Y”, carats, quantity, total carats and compound, rows 1.5 units apart, in black. onlySelection true = only the currently selected gems (the ArtisanGemsListBySelection command); false = every visible gem in the document (ArtisanGemsList). groupBySelection true = the ArtisanGemsListBySelectionGroups variant: the SELECTED gems are bucketed by their Rhino group and drawn as one sub-table per group, each with the group’s name as a header row (plus an “Ungrouped” section for gems in no group). Implies onlySelection. The texts are grouped as “GEMS_LIST” (“GEMS_LIST_BY_SELECTION_GROUPS” for the grouped variant). With no visible gems it draws nothing, like the command; the selection variants throw when the selection holds no gems, mirroring the commands’ cancel.

ParameterTypeDefault
pointPoint3drequired
onlySelectionboolfalse
groupBySelectionboolfalse

CreateMetalsTable

void DraftingApi.CreateMetalsTable(
    Point3d point,
    IEnumerable<string> metals,
    bool includeWax = false,
    bool onlySelection = false)

Draws the metals weight table (the ArtisanMetalsList / ArtisanMetalsListBySelection commands without their checklist dialog and prompts) at point: a header row (Weight / Processed) and one row per requested metal with the estimated cast weight computed from the summed volume of the measured objects — gems are skipped; Breps, extrusions, meshes and SubDs count. The Processed column is the weight after finishing (the configured processed-weight percentage removed); the wax row has none. Everything is added to a new unnamed group, like the commands. metals Metal enum names to list (the command’s checklist: GOLD_24 … PALLADIUM), case-insensitive. Rows keep the checklist order regardless of input order. includeWax true = append the wax weight row (the checklist’s Wax entry), using the configured wax density. onlySelection true = measure only the currently selected objects (ArtisanMetalsListBySelection); false = every non-hidden object in the document.

ParameterTypeDefault
pointPoint3drequired
metalsIEnumerable<string>required
includeWaxboolfalse
onlySelectionboolfalse

CreateReport

bool DraftingApi.CreateReport()

Creates the A4 report layout page for the current design (same as the ArtisanReport command): logo, four detail views (top, perspective, front, side), title block with name, metal + weight, finger size, notes and date. Returns true when the command reports success. Implemented by invoking the command itself — it needs no input, and wrapping it keeps the report identical to the one users get from the ribbon (and picks up future improvements automatically).

Returns bool.

CreateReportFromTemplate

string DraftingApi.CreateReportFromTemplate(
    string template = null,
    string style = null,
    string clientId = null,
    string po = null,
    string cadDesigner = null,
    string description = null,
    IDictionary<string, string> customFields = null,
    bool sphericalGemsMap = false)

Creates a report from a TEMPLATE (the Report panel’s Create button, headless): imports the template’s layout as the next “Report N” page, zooms every detail, and replaces the template tags ([CLIENT_ID], [PO], [STYLE], [CAD_DESIGNER], [DESCRIPTION], metals, [PRODUCT_SIZE], custom fields…) plus the special list markers (METAL_LIST, GEM_LIST, PROCESS_LIST, EXTRA_LIST, GEM_MAP). template template name from ReportTemplates(); null = the first one (the panel’s default selection) style/clientId/po/cadDesigner/description the title-block fields; null keeps the value the document already carries (the panel’s fields) customFields extra [MY_FIELD] tag values by field name; merged over the document’s saved custom fields sphericalGemsMap projection of the GEM_MAP marker The breakdown is recomputed silently when missing (the tags read it). Returns the name of the new layout page (e.g. “Report 1”) — print it to PDF with DocumentApi.ReportPdf(path, pageName: thatName).

ParameterTypeDefault
templatestringnull
stylestringnull
clientIdstringnull
postringnull
cadDesignerstringnull
descriptionstringnull
customFieldsIDictionary<string, string>null
sphericalGemsMapboolfalse

Returns string.

ExportGemsList

string DraftingApi.ExportGemsList(
    string path,
    bool onlySelection = false,
    bool useSystemDecimals = false)

Writes the gems list as a semicolon-delimited CSV (same columns as the ArtisanGemsListToExcel command: Shape, Size X, Size Y, Carats, Quantity, Total Carats), without the save-file dialog. path destination file; “.csv” is appended when missing onlySelection true = only the currently selected gems useSystemDecimals true = format numbers with the system’s decimal separator (the command’s “Force Point” option inverted); default is invariant (point) Returns the full path actually written.

ParameterTypeDefault
pathstringrequired
onlySelectionboolfalse
useSystemDecimalsboolfalse

Returns string.

GenerateDimensions

bool DraftingApi.GenerateDimensions()

Generic auto-dimensioning of the design.

Returns bool.

GenerateDimensionsByBox

void DraftingApi.GenerateDimensionsByBox(
    IEnumerable<Guid> objectIds,
    double offset = 2,
    bool addBox = false)

Bounding-box dimensions (the ArtisanGenerateDimensionsByBox command without its selection prompt): meshes the given objects together at low resolution and draws three linear dimensions around the global bounding box — width in X above the model, depth in Y at its right and the real height in Z. Exactly like the command, the low resolution analysis mesh and a marker point at the Y dimension’s plane origin are also left in the document. objectIds objects to dimension (the command’s selection). offset gap between the geometry and the dimension lines (the command’s Offset option; default 2, valid 0-100). addBox true = also add the bounding box as a Brep (the command’s Box option).

ParameterTypeDefault
objectIdsIEnumerable<Guid>required
offsetdouble2
addBoxboolfalse

GenerateDimensionsFromBangle

void DraftingApi.GenerateDimensionsFromBangle(
    IEnumerable<Guid> objectIds,
    double offset = 2,
    bool addBox = false)

Bangle dimensions (the ArtisanGenerateDimensionsFromBangle command without its selection prompt): meshes the given objects together at low resolution, sections the mesh with the world XY / YZ planes and dimensions the four cross sections (top, bottom, left, right) plus the two global spans between them. The bangle is expected centered on the world origin, like the command expects. objectIds objects to dimension (the command’s selection). offset gap between the geometry and the dimension lines (the command’s Offset option; default 2, valid 0-100). addBox true = also add the bounding box as a Brep (the command’s Box option).

ParameterTypeDefault
objectIdsIEnumerable<Guid>required
offsetdouble2
addBoxboolfalse

GenerateDimensionsFromRing

bool DraftingApi.GenerateDimensionsFromRing()

Ring-specific dimensions: bottom, top and size annotations built from the ring mesh and the document’s finger size.

Returns bool.

ReportTemplates

IReadOnlyList<string> DraftingApi.ReportTemplates()

The report template names available to CreateReportFromTemplate — the *.3dm files in the configured report-templates folder, without extension. Read-only.

Returns IReadOnlyList<string>.