Skip to content

.NET API

AssetsApi

The user’s asset library (the profile curves the parametric tools build from). An asset is a half profile, mirrored unless it carries its own right half. Scripts can list them, draw one as a curve (ExportAsCurve), make a new one from a planar curve of the document (CreateFromCurve, the same conversion as Import curve in the Assets editor) 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
CreateFromCurveSaves a planar curve of the document as a new user asset of type, named name (must be free within the type), and returns it.
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.

CreateFromCurve

AssetInfo AssetsApi.CreateFromCurve(
    string type,
    string name,
    Guid curveId,
    bool symmetric = false)

Saves a planar curve of the document as a new user asset of type, named name (must be free within the type), and returns it. The curve is read in its own plane: up is +Y for a curve drawn on the World XY plane and +Z for one drawn on a front or side plane. Only the shape counts, not the size: the tools scale a profile to their own width and height. An open curve is the left half of the profile, drawn from top to bottom or the reverse, and is mirrored. A closed curve is cut along its vertical middle line; when its two sides differ and the type takes an own right half (CLOSED_PROFILE, CHARM_PROFILE, SIGNET_TOP_PROFILE) both are kept, otherwise the left side is mirrored — symmetric = true forces that. Kinks become sharp points. The curve stays in the document. Check the result with ExportAsCurve.

ParameterTypeDefault
typestringrequired
namestringrequired
curveIdGuidrequired
symmetricboolfalse

Returns AssetInfo.

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>.