Scripting API
Assets
from ArtisanPlugin.Scripting import AssetsApi as assets
AssetsApi gives scripts access to your profile library, the curves the parametric tools build from. Scripts can list assets, reference them by name or id, draw one as a curve to preview it, and organize the library.
Scripts never create assets. An asset is a half profile with per-type rules: it is mirrored across its vertical axis, and a RING_SIDE_CURVE stays open. An arbitrary curve doesn’t follow those rules, so new assets are still drawn in the Assets editor.
| Method | Returns |
|---|---|
Types() | Valid asset types: RING_PROFILE, EXTERNAL_RING_PROFILE, RING_SIDE_CURVE, BEZEL_PROFILE, CHANNEL_PROFILE, CHARM_PROFILE, PEGHEAD_PROFILE, … |
List(type = None) | Assets in the library, optionally filtered by type. Each has Id, Name, Type, Semantic, IsDefault and PointCount (the control points of the half profile, which hint at its complexity) |
GetDefault(type) | The default asset for a type: the one every Create uses when no profile is given |
ExportAsCurve(type, name, width = 0, height = 0, plane = None) | Adds the profile to the document as a curve and returns its id. See Previewing a profile |
Rename / Duplicate / SetDefault / Delete | Library management. See Organizing the library |
Referencing a profile
Wherever a method takes a profile parameter — a creation method like ClassicApi.Create, or a handle setter like TopProfile.SetProfile — you pass the asset’s name. It is matched case-insensitively within its type (and against the asset’s Semantic description, so libraries renamed on migration keep resolving). Omitting it falls back to the type’s default, and an unknown name fails with the list of available ones.
When two assets share a name, pick one by id with "id:<n>" (the Id that List returns), for example profile = "id:42". This works in every profile argument and every SetProfile, and in the MCP tools’ *profile arguments too. An id from another asset type is rejected, and the error says which type the slot takes.
from ArtisanPlugin.Scripting import AssetsApi as assets, ClassicApi as classic, Transaction
for a in assets.List("RING_PROFILE"):
print(a.Name, "-", a.Semantic)
print("default:", assets.GetDefault("RING_PROFILE").Name)
with Transaction.Begin("Ring on a knife-edge profile"):
classic.Create(width = 2.4, profile = "Knife Edge")
Which type does a slot take?
Each profile slot accepts one asset type. The ones the API exposes today:
| Slot | Asset type |
|---|---|
Shank profiles — ClassicApi.Create, IClassic.TopProfile/MidProfile/BottomProfile, ICathedral.Shank, IEternity.Shank.Upper/Lower, IBypass/IAdvancedCathedral stations, IMatchingShank, IWeddingRing.Profile, ISignetFace | RING_PROFILE |
IClassic.ExternalProfile | EXTERNAL_RING_PROFILE |
IAdvancedSignetRing.SetLateralProfile | RING_SIDE_CURVE |
| Bezels | BEZEL_PROFILE |
| Channels and halos | CHANNEL_PROFILE |
| Pegheads | PEGHEAD_PROFILE |
| Charms | CHARM_PROFILE |
Previewing a profile
curveId = assets.ExportAsCurve("RING_PROFILE", "Knife Edge", width = 4, height = 2)
ExportAsCurve adds the asset to the document as a curve, so you can see the exact shape before building with it. You get the shape the tools actually build from: mirrored and closed, or open for RING_SIDE_CURVE.
- Size:
width×heightmm, where0means 5 × 3 like the Assets panel’s insert. A side curve keeps its aspect ratio and only followsheight. - Position: centred on
plane, which defaults to the active construction plane. - Library: unchanged. Delete the curve when you are done looking.
Organizing the library
Each method picks the asset by type and name, where name can also be "id:<n>". Names stay unique within a type, and changes are saved to disk immediately.
| Method | Does |
|---|---|
Rename(type, name, newName) | Renames a user asset |
Duplicate(type, name, newName = None) | Copies any asset, standard ones included, as a new user asset. An empty newName gives "<name> (Copy)". This is how you get an editable copy of a factory profile |
SetDefault(type, name) | Makes it the default of its type, so every Create uses it when no profile is given |
Delete(type, name) | Deletes a user asset permanently. Objects already built from it keep their embedded copy |
Standard (factory) assets cannot be renamed or deleted, because tool defaults and scripts refer to them by name. Duplicate one instead.
from ArtisanPlugin.Scripting import AssetsApi as assets
copy = assets.Duplicate("RING_PROFILE", "Knife Edge", "Knife Edge - soft")
assets.SetDefault("RING_PROFILE", copy.Name)
From the MCP
AI assistants have the same features through MCP:
list_assetsbrowses the library.export_asset_curvedraws a profile as a curve.manage_assetsrenames, duplicates, sets the default and deletes.
See the tool reference. In the Python package, this page corresponds to ra.assets.