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): Name, Notes, the main-stone cost bands P100_90 … |
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): Name, Notes, the main-stone cost bands P100_90 … P10_0 (markup % by how much of the total cost the main stone represents), OnlySettingMarkup (% when only the setting is sold) and the loose diamonds/gemstones bands D0_030, D030_049, D050_069, D070_099, D10 (by carat). 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. {“P100_90”: “35”, “only_setting_markup”: “120”, “Name”: “Retail”}; names are matched ignoring case and underscores. Fields not given keep their value. 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 |