Skip to content

.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
AllISmartComponent handles for every such component in the active document.
ByLayerHandles on the layer with the given full path.
CountNumber of such components in the active document.
FindThe handle for id (the component, or any member of a bail / named pendant group), or null when it is not one of these components.
SelectedComponents 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.

ParameterTypeDefault
layerNamestringrequired

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.

ParameterTypeDefault
idGuidrequired

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.

PropertyType
ComponentstringgetBail | NamedPendant | EngraveRing | Bangle | Bead | Charm | Link | Milgrain | Rope | Texture3D
IdGuidget(from IParametricObject)
LayerNamestringget(from IParametricObject)
MotherGemIdGuidget(from IParametricObject)
ObjectTypestringget(from IParametricObject)
ParametersJsonstringgetthe kernel model, as stored in the object
PositionPoint3dget(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.