Skip to content

Python package

ra.elements

Saved element presets: build from them, apply them, save objects as new ones, organize the library.

import rhinoartisan as ra

Wraps ArtisanPlugin.Scripting.ElementsApi.

Functions

Function
count()Number of objects of this kind in the active document.
delete()PERMANENTLY deletes a saved element (as the panels’ delete does; there is no trash).
duplicate()Copies a saved element as new_name (empty = ” (Copy)”), sharing its preview image.
export_bundle()Exports a saved element as a bundle file (its parameters and preview) to file_path (.zip), to share it or move it to another machine.
find()Finds one saved element by name within a type (case-insensitive).
get_parameters_json()The stored parameters of a saved element, as JSON.
import_bundle()Imports an element bundle exported by ExportBundle (or the panels) into the library.
list()The saved elements of one type, newest library order.
rename()Renames a saved element; the new name must be free within its type.
save_from_object()Saves an existing parametric object’s parameters as a new element (the panels’ “save as element”): object_id is the object, or any member of a parametric group (bail, basket, halo…); name must be new within its type.
set_favorite()Marks or unmarks a saved element as favorite (favorites list first).
types()The element types the library can hold, as the names List() takes.

ra.elements.count()

ra.elements.count(type: str) -> int

Number of objects of this kind in the active document.

ParameterType
typestrrequired

ra.elements.delete()

ra.elements.delete(type: str, name: str) -> bool

PERMANENTLY deletes a saved element (as the panels’ delete does; there is no trash). Objects built from it are not affected. Returns True when it is gone.

ParameterType
typestrrequired
namestrrequired

ra.elements.duplicate()

ra.elements.duplicate(type: str, name: str, new_name=None) -> ElementInfo

Copies a saved element as new_name (empty = ” (Copy)”), sharing its preview image.

ParameterType
typestrrequired
namestrrequired
new_namestroptional — None = the tool default

ra.elements.export_bundle()

ra.elements.export_bundle(type: str, name: str, file_path: str) -> str

Exports a saved element as a bundle file (its parameters and preview) to file_path (.zip), to share it or move it to another machine. Returns the written path.

ParameterType
typestrrequired
namestrrequired
file_pathstrrequired

ra.elements.find()

ra.elements.find(type: str, name: str) -> ElementInfo

Finds one saved element by name within a type (case-insensitive). Throws listing the available names when it does not match, so a script or an agent can correct itself.

ParameterType
typestrrequired
namestrrequired

ra.elements.get_parameters_json()

ra.elements.get_parameters_json(type: str, name: str) -> str

The stored parameters of a saved element, as JSON. Mostly useful to inspect a preset; the facades take the element by name instead.

ParameterType
typestrrequired
namestrrequired

ra.elements.import_bundle()

ra.elements.import_bundle(file_path: str) -> ElementInfo

Imports an element bundle exported by ExportBundle (or the panels) into the library. Returns the imported element.

ParameterType
file_pathstrrequired

ra.elements.list()

ra.elements.list(type: str) -> List[ElementInfo]

The saved elements of one type, newest library order. type is one of Types() — “Bezel”, “Basket”, “Halo”, “Peghead”…

ParameterType
typestrrequired

ra.elements.rename()

ra.elements.rename(type: str, name: str, new_name: str) -> ElementInfo

Renames a saved element; the new name must be free within its type.

ParameterType
typestrrequired
namestrrequired
new_namestrrequired

ra.elements.save_from_object()

ra.elements.save_from_object(object_id: IdLike, name: str) -> ElementInfo

Saves an existing parametric object’s parameters as a new element (the panels’ “save as element”): object_id is the object, or any member of a parametric group (bail, basket, halo…); name must be new within its type. No preview image. Returns the saved element.

ParameterType
object_idIdLikerequired
namestrrequired

ra.elements.set_favorite()

ra.elements.set_favorite(type: str, name: str, favorite=None) -> ElementInfo

Marks or unmarks a saved element as favorite (favorites list first).

ParameterType
typestrrequired
namestrrequired
favoritebooloptional — None = the tool default

ra.elements.types()

ra.elements.types() -> List[str]

The element types the library can hold, as the names List() takes.