Skip to content

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)
ParameterDefaultMeaning
quoteCertifiedTrueTrue 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.

FieldTypeMeaning
CurrencystrThe manufacturer’s currency code
TotalfloatThe grand total across all categories
TotalFormattedstrTotal with the currency symbol, e.g. "1,234.00 €". str(d) returns the same
MetalTotalfloatTotal metal cost
MetalslistOne PriceMetalLine per metal in the piece
DiamondsTotalfloatCertified diamonds total
DiamondsCaratsfloatTotal carats of certified diamonds
DiamondsCountintNumber of certified diamonds
DiamondslistOne PriceDiamondLine per certified diamond
GemsTotalfloatGemstones total
GemsCaratsfloatTotal carats of table-priced gems
GemsCountintNumber of table-priced gems
GemslistOne PriceGemLine per gem group
ProcessesTotalfloatAll labour and processes
ProcessesMetalCostfloatThe metal-process part: printing, cast-finish-polish, finishing, rhodium
ProcessesSettingCostfloatThe setting-labour part
ProcessesAdditionalCostfloatThe additional-processes part
MetalProcesseslistOne PriceMetalProcessLine per metal
SettingProcesseslistOne PriceSettingProcessLine per setting type
AdditionalProcesseslistPriceNamedCost items — name and cost
ExtrasTotalfloatExtra components total
ExtraslistPriceNamedCost items — name and cost

The line shapes

PriceMetalLine — one per metal:

FieldTypeMeaning
MetalstrMetal name, e.g. "Gold 18K Yellow"
PricePerGramfloatThe market’s price per gram
WeightGramsfloatThe modelled weight, grams
WastefloatThe waste allowance added on top
TotalWeightGramsfloatWeight plus waste — what is actually charged
CostfloatTotalWeightGrams × PricePerGram

PriceDiamondLine — one per certified diamond:

FieldTypeMeaning
DealerstrThe quoting dealer
CertificateIdstrThe stone’s certificate reference
ShapestrCut name, e.g. "ROUND"
CaratsfloatThe stone’s carat weight
LabGrownboolTrue for a lab-grown stone
PricefloatThe quoted price; 0 when unquoted
QuotedboolFalse 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:

FieldTypeMeaning
ShapestrCut name
SizeMmfloatStone size, millimetres
CountintStones in the group
CaratsfloatTotal carats of the group
PricePerCaratfloatFrom the manufacturer’s price tables
SievestrThe sieve designation the table matched
SettingTypestrHow the stones are set, e.g. "Prong"
CostfloatThe group’s total

PriceMetalProcessLine — one per metal:

FieldTypeMeaning
MetalstrMetal name
PrintingCostfloat3D-printing cost
PrintingSizestrThe print size band applied
CastFinishPolishCostfloatCast-finish-polish cost
FinishingCostfloatFinishing cost
RhodiumCostfloatRhodium 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.”