.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 | |
|---|---|
Delete | Permanently deletes a user asset from the library. |
Duplicate | Copies an asset (standard ones included) as a new user asset named newName (empty = ” |
ExportAsCurve | 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). |
GetDefault | The default asset for a type — the one every Create uses when no profile name is given. |
List | Lists the assets in the library, optionally filtered by type (“RING_PROFILE”, “BEZEL_PROFILE”, “CHARM_PROFILE”, …). |
Rename | Renames a user asset. |
SetDefault | Makes an asset the default of its type: every Create uses it when no profile is given. |
Types | Valid 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.
| Parameter | Type | Default |
|---|---|---|
type | string | required |
name | string | required |
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 = ”
| Parameter | Type | Default |
|---|---|---|
type | string | required |
name | string | required |
newName | string | null |
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:
| Parameter | Type | Default |
|---|---|---|
type | string | required |
name | string | required |
width | double | 0 |
height | double | 0 |
plane | Plane? | 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.
| Parameter | Type | Default |
|---|---|---|
type | string | required |
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”, …).
| Parameter | Type | Default |
|---|---|---|
type | string | null |
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.
| Parameter | Type | Default |
|---|---|---|
type | string | required |
name | string | required |
newName | string | required |
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.
| Parameter | Type | Default |
|---|---|---|
type | string | required |
name | string | required |
Returns AssetInfo.
Types
IReadOnlyList<string> AssetsApi.Types()
Valid values for the type arguments.
Returns IReadOnlyList<string>.