Skip to content

.NET API

AssetsApi

The user’s asset library (the profile curves the parametric tools build from). Assets are never CREATED from scripts — an asset is a half profile with per-type rules a free curve doesn’t follow; the user draws them in the Assets editor. Scripts can list them, draw one as a curve (ExportAsCurve) and organize the library: rename, duplicate, set the default, delete user assets (standard ones are protected).

from ArtisanPlugin.Scripting import AssetsApi

See also the guide, API Reference › Assets, and the Python package, ra.assets.

Methods

Method
DeletePermanently deletes a user asset from the library.
DuplicateCopies an asset (standard ones included) as a new user asset named newName (empty = ” (Copy)”), preview included.
ExportAsCurveAdds the asset’s profile to the document as a curve so it can be seen before choosing it: the shape the tools build from (mirrored and closed, or open for RING_SIDE_CURVE), sized width x height mm (0 = 5 x 3, like the Assets panel’s insert; side curves keep their aspect and only follow height) and centered on plane’s origin (default: the active construction plane).
GetDefaultThe default asset for a type — the one every Create uses when no profile name is given.
ListLists the assets in the library, optionally filtered by type (“RING_PROFILE”, “BEZEL_PROFILE”, “CHARM_PROFILE”, …).
RenameRenames a user asset.
SetDefaultMakes an asset the default of its type: every Create uses it when no profile is given.
TypesValid values for the type arguments.

Delete

bool AssetsApi.Delete(string type, string name)

Permanently deletes a user asset from the library. Standard assets are protected. Objects already built from it keep their embedded copy. Returns true when deleted.

ParameterTypeDefault
typestringrequired
namestringrequired

Returns bool.

Duplicate

AssetInfo AssetsApi.Duplicate(string type, string name, string newName = null)

Copies an asset (standard ones included) as a new user asset named newName (empty = ” (Copy)”), preview included.

ParameterTypeDefault
typestringrequired
namestringrequired
newNamestringnull

Returns AssetInfo.

ExportAsCurve

Guid AssetsApi.ExportAsCurve(
    string type,
    string name,
    double width = 0,
    double height = 0,
    Plane? plane = null)

Adds the asset’s profile to the document as a curve so it can be seen before choosing it: the shape the tools build from (mirrored and closed, or open for RING_SIDE_CURVE), sized width x height mm (0 = 5 x 3, like the Assets panel’s insert; side curves keep their aspect and only follow height) and centered on plane’s origin (default: the active construction plane). name accepts the asset name or “id:”. Returns the curve id.

ParameterTypeDefault
typestringrequired
namestringrequired
widthdouble0
heightdouble0
planePlane?null

Returns Guid.

GetDefault

AssetInfo AssetsApi.GetDefault(string type)

The default asset for a type — the one every Create uses when no profile name is given.

ParameterTypeDefault
typestringrequired

Returns AssetInfo.

List

IReadOnlyList<AssetInfo> AssetsApi.List(string type = null)

Lists the assets in the library, optionally filtered by type (“RING_PROFILE”, “BEZEL_PROFILE”, “CHARM_PROFILE”, …).

ParameterTypeDefault
typestringnull

Returns IReadOnlyList<AssetInfo>.

Rename

AssetInfo AssetsApi.Rename(string type, string name, string newName)

Renames a user asset. Standard (factory) assets cannot be renamed: tool defaults and scripts refer to them by name. The new name must be free within the type.

ParameterTypeDefault
typestringrequired
namestringrequired
newNamestringrequired

Returns AssetInfo.

SetDefault

AssetInfo AssetsApi.SetDefault(string type, string name)

Makes an asset the default of its type: every Create uses it when no profile is given.

ParameterTypeDefault
typestringrequired
namestringrequired

Returns AssetInfo.

Types

IReadOnlyList<string> AssetsApi.Types()

Valid values for the type arguments.

Returns IReadOnlyList<string>.