.NET API
DraftingExtraApi
Drafting / documentation helpers that DraftingApi does not cover: dimension value overrides, the logo file, the technical chart, the grouped gems CSV, report templates and the Artisan window layout. Companion of DraftingApi (which is not partial, hence a second class).
from ArtisanPlugin.Scripting import DraftingExtraApi
See also the Python package, ra.drafting.
Methods
| Method | |
|---|---|
AddLogo | Creates the report logo file from the given objects (same as ArtisanAddLogo): copies them, scales the copies so the largest extent is 28 mm, centers them at (65, 25, 0), exports the copies as logo.3dm in the Artisan user folder and deletes the copies. |
ApplyArtisanLayout | Applies the Artisan window layout (ArtisanLayout / the ribbon’s Window Layout button): imports ArtisanSkin.rhw and activates the “Artisan” layout. |
CreateTechnicalChart | The technical chart (ArtisanTechnicalChart panel, headless): the production breakdown WITHOUT prices — per metal the net weight, waste, total and wax weight, volume and surface area; the gems by shape and size with carats and setting type; the setting, printing and extra processes. |
ExportGemsListByIds | Writes the gems list of the given gems as a semicolon-delimited CSV (ArtisanGemsListToExcelBySelection / …BySelectionGroups without the pick and the save dialog; columns Shape, Size X, Size Y, Carats, Quantity, Total Carats). |
OpenReportTemplate | Opens a report template for editing (ArtisanOpenReportTemplate without the file dialog). |
ReduceDimensions | Reduces the DISPLAYED value of distance dimensions by percentage (same as ArtisanDimensionsReduce / …BySelection): only the text is overridden, the geometry is untouched. |
RestoreDimensions | Restores distance dimensions to their real measured value by putting back the ”<>” placeholder (same as ArtisanDimensionsRestore / …BySelection). |
SaveReportTemplate | Saves the ACTIVE document as a report template (ArtisanSaveReportTemplate without the save dialog): a “Save As” into the report-templates folder, so the document adopts that path. |
AddLogo
string DraftingExtraApi.AddLogo(IEnumerable<Guid> ids)
Creates the report logo file from the given objects (same as ArtisanAddLogo): copies them, scales the copies so the largest extent is 28 mm, centers them at (65, 25, 0), exports the copies as logo.3dm in the Artisan user folder and deletes the copies. The originals are untouched. Returns the full path of logo.3dm.
| Parameter | Type | Default |
|---|---|---|
ids | IEnumerable<Guid> | required |
Returns string.
ApplyArtisanLayout
bool DraftingExtraApi.ApplyArtisanLayout()
Applies the Artisan window layout (ArtisanLayout / the ribbon’s Window Layout button): imports ArtisanSkin.rhw and activates the “Artisan” layout. Rhino 8 or later only. Returns true when applied.
Returns bool.
CreateTechnicalChart
TechnicalChartResult DraftingExtraApi.CreateTechnicalChart(
string path = null,
bool quoteCertified = true)
The technical chart (ArtisanTechnicalChart panel, headless): the production breakdown WITHOUT prices — per metal the net weight, waste, total and wax weight, volume and surface area; the gems by shape and size with carats and setting type; the setting, printing and extra processes. The breakdown is recomputed first (the panel’s Create button) and stored in the document. path optional export: “.xlsx” (the panel’s Excel, no prices) or “.json” (the raw breakdown object); null = no file quoteCertified false = skip the live Nivoda quote of certified diamonds (faster, offline) Returns the chart as data (plus Path when a file was written).
| Parameter | Type | Default |
|---|---|---|
path | string | null |
quoteCertified | bool | true |
Returns TechnicalChartResult.
ExportGemsListByIds
string DraftingExtraApi.ExportGemsListByIds(
string path,
IEnumerable<Guid> ids = null,
bool groupByRhinoGroups = false,
bool useSystemDecimals = false)
Writes the gems list of the given gems as a semicolon-delimited CSV (ArtisanGemsListToExcelBySelection / …BySelectionGroups without the pick and the save dialog; columns Shape, Size X, Size Y, Carats, Quantity, Total Carats). Non-gem ids are ignored. ids gem ids; null = every visible gem groupByRhinoGroups true = one section per Rhino group the gems belong to (group name as header) plus an “Ungrouped Gems” section at the end useSystemDecimals true = system decimal separator (default point) Returns the full path written (“.csv” appended when missing).
| Parameter | Type | Default |
|---|---|---|
path | string | required |
ids | IEnumerable<Guid> | null |
groupByRhinoGroups | bool | false |
useSystemDecimals | bool | false |
Returns string.
OpenReportTemplate
string DraftingExtraApi.OpenReportTemplate(
string template,
bool saveChangesFirst = false,
bool discardChanges = false)
Opens a report template for editing (ArtisanOpenReportTemplate without the file dialog). The active document is REPLACED by the template file — every id of the previous document becomes invalid. template name from DraftingApi.ReportTemplates() or a full .3dm path saveChangesFirst true = save the current document before (it must already have a path) discardChanges true = lose unsaved changes silently Fails when the document has unsaved changes and neither flag is set. Returns the full path opened.
| Parameter | Type | Default |
|---|---|---|
template | string | required |
saveChangesFirst | bool | false |
discardChanges | bool | false |
Returns string.
ReduceDimensions
DimensionValueReport DraftingExtraApi.ReduceDimensions(
double percentage = 5,
IEnumerable<Guid> ids = null)
Reduces the DISPLAYED value of distance dimensions by percentage (same as ArtisanDimensionsReduce / …BySelection): only the text is overridden, the geometry is untouched. Metal shrinks when cast, so plans often need the pre-shrinkage value. Angular dimensions and dimensions already overridden are skipped. percentage 0 = the command default (5); valid 0-100 ids dimension ids; null = every dimension in the document Returns the counts: Changed and Skipped (already overridden).
| Parameter | Type | Default |
|---|---|---|
percentage | double | 5 |
ids | IEnumerable<Guid> | null |
Returns DimensionValueReport.
RestoreDimensions
int DraftingExtraApi.RestoreDimensions(IEnumerable<Guid> ids = null)
Restores distance dimensions to their real measured value by putting back the ”<>” placeholder (same as ArtisanDimensionsRestore / …BySelection). Dimensions that already show the real value are left alone. ids dimension ids; null = every dimension in the document Returns the number of dimensions restored.
| Parameter | Type | Default |
|---|---|---|
ids | IEnumerable<Guid> | null |
Returns int.
SaveReportTemplate
string DraftingExtraApi.SaveReportTemplate(string name, bool overwrite = false)
Saves the ACTIVE document as a report template (ArtisanSaveReportTemplate without the save dialog): a “Save As” into the report-templates folder, so the document adopts that path. Design a layout page with the [TAGS] first; afterwards it is listed by DraftingApi.ReportTemplates() and usable with DraftingApi.CreateReportFromTemplate(name). name template name (“.3dm” optional) or a full .3dm path overwrite true = replace an existing template of that name Returns the full path written.
| Parameter | Type | Default |
|---|---|---|
name | string | required |
overwrite | bool | false |
Returns string.