Skip to content

Python package

ra.smart_component

Edit bails, named pendants, bangles, beads, charms, links, milgrain, ropes, 3D textures and ring engravings after creation (their model as JSON).

import rhinoartisan as ra

Wraps ArtisanPlugin.Scripting.SmartComponentApi.

Functions

Function
all()SmartComponent handles for every such component in the active document.
by_layer()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 None when it is not one of these components.
selected()Components with at least one selected member.

ra.smart_component.all()

ra.smart_component.all() -> List[SmartComponent]

SmartComponent handles for every such component in the active document.

ra.smart_component.by_layer()

ra.smart_component.by_layer(layer_name: str) -> List[SmartComponent]

Handles on the layer with the given full path.

ParameterType
layer_namestrrequired

ra.smart_component.count()

ra.smart_component.count() -> int

Number of such components in the active document.

ra.smart_component.find()

ra.smart_component.find(id: IdLike) -> SmartComponent

The handle for id (the component, or any member of a bail / named pendant group), or None when it is not one of these components.

ParameterType
idIdLikerequired

ra.smart_component.selected()

ra.smart_component.selected() -> List[SmartComponent]

Components with at least one selected member.

Handles

Objects returned by the functions above. Assigning a settable property regenerates the object; the change is one undo step inside ra.transaction().

SmartComponent (handle)

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.

PropertyTypeSettable
componentstrBail | NamedPendant | EngraveRing | Bangle | Bead | Charm | Link | Milgrain | Rope | Texture3D
layer_namestr
mother_gem_idstr
object_typestr
parameters_jsonstrthe kernel model, as stored in the object
positionPoint3d
Method
delete()
get_parameter(path: str) -> strdotted path; None when absent
move(translation: VectorLike)
set_element(element: str)Applies a saved element of the same component (ra.elements.list(“Bail”)…): its parameters replace the current ones (a named pendant keeps its text) and it regenerates in place.
set_parameter(path: str, value: str)one value (kept as the model’s number / bool / string); regenerates
set_parameters(json: str)Several values at once, as a JSON object merged into the model ({“DiameterTop”: 3, “TopProfile”: {“Width”: 2}}); regenerates once.

Plus what every handle has: id, delete(), update(**kwargs), parameters(), equality and hashing by id, and raw (the underlying .NET object).