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 = ” |
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.
| Parameter | Type | |
|---|---|---|
type | str | required |
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.
| Parameter | Type | |
|---|---|---|
type | str | required |
name | str | required |
ra.elements.duplicate()
ra.elements.duplicate(type: str, name: str, new_name=None) -> ElementInfo
Copies a saved element as new_name (empty = ”
| Parameter | Type | |
|---|---|---|
type | str | required |
name | str | required |
new_name | str | optional — 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.
| Parameter | Type | |
|---|---|---|
type | str | required |
name | str | required |
file_path | str | required |
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.
| Parameter | Type | |
|---|---|---|
type | str | required |
name | str | required |
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.
| Parameter | Type | |
|---|---|---|
type | str | required |
name | str | required |
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.
| Parameter | Type | |
|---|---|---|
file_path | str | required |
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”…
| Parameter | Type | |
|---|---|---|
type | str | required |
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.
| Parameter | Type | |
|---|---|---|
type | str | required |
name | str | required |
new_name | str | required |
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.
| Parameter | Type | |
|---|---|---|
object_id | IdLike | required |
name | str | required |
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).
| Parameter | Type | |
|---|---|---|
type | str | required |
name | str | required |
favorite | bool | optional — None = the tool default |
ra.elements.types()
ra.elements.types() -> List[str]
The element types the library can hold, as the names List() takes.