.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 | |
|---|---|
CreateFromCurve | 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. |
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. |
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.
| Parameter | Type | Default |
|---|---|---|
type | string | required |
name | string | required |
curveId | Guid | required |
symmetric | bool | false |
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.
| 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>.