Scripting API
Line detail
from ArtisanPlugin.Scripting import PricingApi as pricing
CalculateDetailed runs the same Breakdown computation as Calculate but returns the panel’s full line-level detail: one line per metal (weight, waste, price per gram), per certified diamond (dealer, certificate, quote), per gem group (count, carats, sieve, price per carat, setting type), per process and per extra component. It is the payload to script quotes, cost reports and spreadsheets from.
Usage
d = pricing.CalculateDetailed() # -> a PriceBreakdownDetails
offline = pricing.CalculateDetailed(quoteCertified=False)
| Parameter | Default | Meaning |
|---|---|---|
quoteCertified | True | True fetches live Nivoda quotes for the certified diamonds (network); False skips them — offline, but those stones price as 0 and their line’s Quoted flag is False. Same semantics as Calculate |
What it returns
A PriceBreakdownDetails. Every cost is a double in the active manufacturer’s currency (Currency says which); weights are grams, stone sizes are millimetres, stone weights are carats.
| Field | Type | Meaning |
|---|---|---|
Currency | str | The manufacturer’s currency code |
Total | float | The grand total across all categories |
TotalFormatted | str | Total with the currency symbol, e.g. "1,234.00 €". str(d) returns the same |
MetalTotal | float | Total metal cost |
Metals | list | One PriceMetalLine per metal in the piece |
DiamondsTotal | float | Certified diamonds total |
DiamondsCarats | float | Total carats of certified diamonds |
DiamondsCount | int | Number of certified diamonds |
Diamonds | list | One PriceDiamondLine per certified diamond |
GemsTotal | float | Gemstones total |
GemsCarats | float | Total carats of table-priced gems |
GemsCount | int | Number of table-priced gems |
Gems | list | One PriceGemLine per gem group |
ProcessesTotal | float | All labour and processes |
ProcessesMetalCost | float | The metal-process part: printing, cast-finish-polish, finishing, rhodium |
ProcessesSettingCost | float | The setting-labour part |
ProcessesAdditionalCost | float | The additional-processes part |
MetalProcesses | list | One PriceMetalProcessLine per metal |
SettingProcesses | list | One PriceSettingProcessLine per setting type |
AdditionalProcesses | list | PriceNamedCost items — name and cost |
ExtrasTotal | float | Extra components total |
Extras | list | PriceNamedCost items — name and cost |
The line shapes
PriceMetalLine — one per metal:
| Field | Type | Meaning |
|---|---|---|
Metal | str | Metal name, e.g. "Gold 18K Yellow" |
PricePerGram | float | The market’s price per gram |
WeightGrams | float | The modelled weight, grams |
Waste | float | The waste allowance added on top |
TotalWeightGrams | float | Weight plus waste — what is actually charged |
Cost | float | TotalWeightGrams × PricePerGram |
PriceDiamondLine — one per certified diamond:
| Field | Type | Meaning |
|---|---|---|
Dealer | str | The quoting dealer |
CertificateId | str | The stone’s certificate reference |
Shape | str | Cut name, e.g. "ROUND" |
Carats | float | The stone’s carat weight |
LabGrown | bool | True for a lab-grown stone |
Price | float | The quoted price; 0 when unquoted |
Quoted | bool | False when there is no live Nivoda quote — offline, quoteCertified=False, or no match. The stone still counts in DiamondsCarats/DiamondsCount but prices as 0 |
Always check Quoted before presenting a total as final: a False anywhere means the grand total is understated.
PriceGemLine — one per group of identical table-priced gems:
| Field | Type | Meaning |
|---|---|---|
Shape | str | Cut name |
SizeMm | float | Stone size, millimetres |
Count | int | Stones in the group |
Carats | float | Total carats of the group |
PricePerCarat | float | From the manufacturer’s price tables |
Sieve | str | The sieve designation the table matched |
SettingType | str | How the stones are set, e.g. "Prong" |
Cost | float | The group’s total |
PriceMetalProcessLine — one per metal:
| Field | Type | Meaning |
|---|---|---|
Metal | str | Metal name |
PrintingCost | float | 3D-printing cost |
PrintingSize | str | The print size band applied |
CastFinishPolishCost | float | Cast-finish-polish cost |
FinishingCost | float | Finishing cost |
RhodiumCost | float | Rhodium plating cost |
PriceSettingProcessLine — one per setting type: SettingType (str), Count (int, stones set), Cost (float, labour total).
PriceNamedCost — used by AdditionalProcesses and Extras: Name (str) and Cost (float).
Side effects and errors
Like Calculate, it never modifies geometry or settings and needs no Transaction, but it does recompute and replace the document’s cached breakdown — the one the Breakdown panel shows. It throws:
- no open document — “No active document.”
- the engine could not produce a breakdown — “Pricing could not be computed for this document.”