.NET API
SmartComponentApi
Smart components without a typed facade handle of their own (Bail, Named Pendant, Bangle, Bead, Charm): find them to edit them after creation. The creators stay in BailApi, NamedPendantApi, BangleApi…
from ArtisanPlugin.Scripting import SmartComponentApi
See also the guide, Accessories › Editing smart components, and the Python package, ra.smart_component.
Methods
| Method | |
|---|---|
All | ISmartComponent handles for every such component in the active document. |
ByLayer | Handles on the layer with the given full path. |
Count | Number of such components in the active document. |
Find | The handle for id (the component, or any member of a bail / named pendant group), or null when it is not one of these components. |
Selected | Components with at least one selected member. |
All
IReadOnlyList<ISmartComponent> SmartComponentApi.All()
ISmartComponent handles for every such component in the active document.
Returns IReadOnlyList<ISmartComponent>.
ByLayer
IReadOnlyList<ISmartComponent> SmartComponentApi.ByLayer(string layerName)
Handles on the layer with the given full path.
| Parameter | Type | Default |
|---|---|---|
layerName | string | required |
Returns IReadOnlyList<ISmartComponent>.
Count
int SmartComponentApi.Count()
Number of such components in the active document.
Returns int.
Find
ISmartComponent SmartComponentApi.Find(Guid id)
The handle for id (the component, or any member of a bail / named pendant group), or null when it is not one of these components.
| Parameter | Type | Default |
|---|---|---|
id | Guid | required |
Returns ISmartComponent.
Selected
IReadOnlyList<ISmartComponent> SmartComponentApi.Selected()
Components with at least one selected member.
Returns IReadOnlyList<ISmartComponent>.
Handles and sections
What the methods above hand back. A handle’s setters regenerate the object; wrap changes in a Transaction so they land as one undo step.
ISmartComponent
Handle — extends IParametricObject.
A smart component that has no typed handle of its own — Bail, Named Pendant, Engrave Ring (parametric groups) and Bangle, Bead, Charm, Link, Milgrain, Rope, Texture3D (custom objects) — edited through its kernel model as JSON. Paths are the model’s property path (“TopProfile.Width”, “DiameterTop”; snake_case works too: “top_profile.width”), shown by ParametersJson. Every change regenerates the component in place (same id), like the panel.
| Property | Type | ||
|---|---|---|---|
Component | string | get | Bail | NamedPendant | EngraveRing | Bangle | Bead | Charm | Link | Milgrain | Rope | Texture3D |
Id | Guid | get | (from IParametricObject) |
LayerName | string | get | (from IParametricObject) |
MotherGemId | Guid | get | (from IParametricObject) |
ObjectType | string | get | (from IParametricObject) |
ParametersJson | string | get | the kernel model, as stored in the object |
Position | Point3d | get | (from IParametricObject) |
| Method | |
|---|---|
void Delete() | (from IParametricObject) |
string GetParameter(string path) | dotted path; null when absent |
void Move(Vector3d translation) | (from IParametricObject) |
void SetElement(string element) | Applies a saved element of the same component (ElementsApi.List(“Bail”)…): its parameters replace the current ones (a named pendant keeps its text) and it regenerates in place. |
void SetParameter(string path, string value) | one value (kept as the model’s number / bool / string); regenerates |
void SetParameters(string json) | Several values at once, as a JSON object merged into the model ({“DiameterTop”: 3, “TopProfile”: {“Width”: 2}}); regenerates once. |