Python package
ra.pricing
Prices and cost breakdowns, markup and taxes profiles.
import rhinoartisan as ra
Wraps ArtisanPlugin.Scripting.PricingApi, ArtisanPlugin.Scripting.PricingExtraApi.
Functions
| Function | |
|---|---|
calculate() | Recomputes the price for the current document using the active manufacturer / market and returns the totals plus the per-category breakdown. |
calculate_detailed() | Like Calculate(), but returning the SAME line-level detail the Breakdown panel shows: one line per metal (weight, waste, price), per certified diamond, per gem group (count, carats, sieve, price per carat, setting type), per process (metal processes, setting labor, additionals) and per extra component. |
get_settings_json() | The settings as indented JSON — the whole manufacturer, or just the node at path (dot-separated, case-insensitive, [n] for list items: “Markets”, “Diamonds.CertificateFromCt”, “Cfp.Items[2]”). |
set_setting() | Updates ONE cost value by path and persists the manufacturer file — e.g. |
show_panel() | Opens the Breakdown (price details) panel. |
get_markup_json() | The markup profile as indented JSON (the ArtisanMarkup dialog). |
get_taxes_json() | The tax profile as indented JSON (the ArtisanTaxes dialog): Mode (None, European, American, Canadian, OtherCountry), the region and tax id of that mode (EuropeanCountry/EuropeanVatId, AmericanState/ AmericanSaleTaxId, CanadianProvince/CanadianSaleTaxId, OtherCountry/ UniqueTaxPercentage) and IncludeTaxesToPricing. |
set_markup() | Updates one or more markup values and saves Markup.json (the dialog’s Accept). |
set_taxes() | Updates the tax profile and saves Taxes.json (the dialog’s Accept). |
tax_regions() | The valid regions for a tax mode, to pick region in SetTaxes: EU member countries (European), US states (American), Canadian provinces (Canadian) or every country (OtherCountry). |
ra.pricing.calculate()
ra.pricing.calculate(quote_certified=None, export=None) -> PriceResult
Recomputes the price for the current document using the active manufacturer / market and returns the totals plus the per-category breakdown. Use it to answer “what’s the price?” without opening the panel. quote_certified False = skip the live Nivoda quotes for the certified diamonds (every diamond above the manufacturer’s CertificateFromCt threshold): fast and offline, but those stones price as 0. Default True = quote them live with your saved Nivoda filter, like the panel. export True = export sale: metal is costed without the import duty / levy set in Breakdown Settings; False = domestic (duty included); None keeps the document’s current choice.
| Parameter | Type | |
|---|---|---|
quote_certified | bool | optional — None = the tool default |
export | Optional[bool] | optional — None = the tool default |
ra.pricing.calculate_detailed()
ra.pricing.calculate_detailed(quote_certified=None, export=None) -> PriceBreakdownDetails
Like Calculate(), but returning the SAME line-level detail the Breakdown panel shows: one line per metal (weight, waste, price), per certified diamond, per gem group (count, carats, sieve, price per carat, setting type), per process (metal processes, setting labor, additionals) and per extra component. Read-only.
| Parameter | Type | |
|---|---|---|
quote_certified | bool | optional — None = the tool default |
export | Optional[bool] | optional — None = the tool default |
ra.pricing.get_settings_json()
ra.pricing.get_settings_json(path=None) -> str
The settings as indented JSON — the whole manufacturer, or just the node at path (dot-separated, case-insensitive, [n] for list items: “Markets”, “Diamonds.CertificateFromCt”, “Cfp.Items[2]”). Read-only.
| Parameter | Type | |
|---|---|---|
path | str | optional — None = the tool default |
ra.pricing.set_setting()
ra.pricing.set_setting(path: str, value: str)
Updates ONE cost value by path and persists the manufacturer file — e.g. SetSetting(“Markets.Gold”, “68.5”) or SetSetting(“Diamonds.CertificateFromCt”, “0.30”). The value string is converted to the target type (number, bool, string or enum name). The next Calculate() prices with the new value.
| Parameter | Type | |
|---|---|---|
path | str | required |
value | str | required |
ra.pricing.show_panel()
ra.pricing.show_panel()
Opens the Breakdown (price details) panel. Call after Calculate() so the panel shows the freshly computed totals. Must run on the UI thread (Flow Studio’s Apply does).
ra.pricing.get_markup_json()
ra.pricing.get_markup_json() -> str
The markup profile as indented JSON (the ArtisanMarkup dialog). Every block is “fixed” (one percentage) or “dynamic”: the setting (SettingMode, OnlySettingMarkup as the fixed %, P100_90 … P10_0 as the tiers by the main stone’s share of the cost), natural diamonds (DiamondMode, DiamondMarkup, DiamondMatrix: shape -> carat range -> %, where the ALL row is the base and a shape only holds the cells that differ), lab-grown diamonds (LabMode, LabMarkup, LabMatrix; while the three are None they follow the natural ones) and colored gemstones (GemstoneMode, GemstoneMarkup, GemstoneRanges by cost, each with UpTo and Percentage, UpTo None for the open last one). Also Name and Notes; D0_030 … D10 are the carat tiers of older profiles, read only when there is no DiamondMatrix. All values are percentages. Read-only.
ra.pricing.get_taxes_json()
ra.pricing.get_taxes_json() -> str
The tax profile as indented JSON (the ArtisanTaxes dialog): Mode (None, European, American, Canadian, OtherCountry), the region and tax id of that mode (EuropeanCountry/EuropeanVatId, AmericanState/ AmericanSaleTaxId, CanadianProvince/CanadianSaleTaxId, OtherCountry/ UniqueTaxPercentage) and IncludeTaxesToPricing. Read-only.
ra.pricing.set_markup()
ra.pricing.set_markup(values: Dict[str, str]) -> str
Updates one or more markup values and saves Markup.json (the dialog’s Accept). values maps field name -> value, e.g. {“SettingMode”: “dynamic”, “P100_90”: “35”, “diamond_markup”: “40”, “Name”: “Retail”}; names are matched ignoring case and underscores, modes are “fixed” or “dynamic”, and an empty value clears an optional percentage. DiamondMatrix and LabMatrix take a JSON object that is merged cell by cell, e.g. {“ALL”: {“c100_149”: 40}, “ROUND”: {“c100_149”: 45}}: shapes are ALL, ROUND, PRINCESS, CUSHION, EMERALD, PEAR, OVAL, RADIANT, ASSCHER, MARQUISE and HEART, ranges are c030_049, c050_069, c070_099, c100_149, c150_199, c200_299 and c300, and None empties a cell. GemstoneRanges takes the whole JSON list, e.g. [{“UpTo”: 300, “Percentage”: 150}, {“Percentage”: 100}], where the range without UpTo is the open last one. Setting a lab-grown field gives the lab-grown diamonds their own copy of the natural values first; an empty LabMode makes them follow the natural ones again. Fields not given keep their value, and nothing is saved when a value is rejected. Returns the profile JSON after the change.
| Parameter | Type | |
|---|---|---|
values | Dict[str, str] | required |
ra.pricing.set_taxes()
ra.pricing.set_taxes(mode=None, region=None, tax_id=None, unique_tax_percentage=None, include_taxes_to_pricing=None, name=None, notes=None) -> str
Updates the tax profile and saves Taxes.json (the dialog’s Accept). Every argument is optional; None/NaN keeps the stored value. mode None, European, American, Canadian or OtherCountry region country / state / province of the (new or stored) mode, by code or name — see TaxRegions() tax_id the VAT id (European) or sale tax id (American, Canadian); ignored by the other modes unique_tax_percentage flat tax % (OtherCountry only) include_taxes_to_pricing bake the tax into prices (European and OtherCountry only, as in the dialog) name, notes the profile’s info fields Returns the profile JSON after the change.
| Parameter | Type | |
|---|---|---|
mode | str | optional — None = the tool default |
region | str | optional — None = the tool default |
tax_id | str | optional — None = the tool default |
unique_tax_percentage | float | optional — None = the tool default |
include_taxes_to_pricing | Optional[bool] | optional — None = the tool default |
name | str | optional — None = the tool default |
notes | str | optional — None = the tool default |
ra.pricing.tax_regions()
ra.pricing.tax_regions(mode: str) -> List[TaxRegion]
The valid regions for a tax mode, to pick region in SetTaxes: EU member countries (European), US states (American), Canadian provinces (Canadian) or every country (OtherCountry). Read-only.
| Parameter | Type | |
|---|---|---|
mode | str | required |