Python package
ra.peghead
Peghead seats under a stone: prongs, height, thickness.
import rhinoartisan as ra
Wraps ArtisanPlugin.Scripting.PegheadApi.
Functions
| Function | |
|---|---|
all() | Peghead handles for every object of this kind in the active document (empty when there is no document). |
by_layer() | Peghead handles on the layer with the given full path (empty when the layer does not exist). |
count() | Number of objects of this kind in the active document. |
create() | Builds a peghead (prong head) around an existing gem — the ArtisanPeghead tool, headless. |
find() | The handle for id, or None when the id does not belong to an object of this kind. |
for_gem() | Peghead handles whose mother gem is gem_id (empty for None). |
selected() | Pegheads currently selected in the active doc. |
ra.peghead.all()
ra.peghead.all() -> List[Peghead]
Peghead handles for every object of this kind in the active document (empty when there is no document).
ra.peghead.by_layer()
ra.peghead.by_layer(layer_name: str) -> List[Peghead]
Peghead handles on the layer with the given full path (empty when the layer does not exist).
| Parameter | Type | |
|---|---|---|
layer_name | str | required |
ra.peghead.count()
ra.peghead.count() -> int
Number of objects of this kind in the active document.
ra.peghead.create()
ra.peghead.create(gem_id: IdLike, prongs=None, height=None, thickness=None, girdle_width=None, over_girdle_height=None, gem_inside=None, profile=None, element=None) -> Peghead
Builds a peghead (prong head) around an existing gem — the ArtisanPeghead tool, headless. gem_id must be a gem in the active document; the peghead is a parametric child of that gem. Millimetres; omitting keeps the tool default (or the user’s saved defaults): height 5, thickness 1, girdle_width 0.8, over_girdle_height 1. prongs 0 keeps the default (4); use 3, 4, 6… or a negative count for the rotated variant (-4 = 4 prongs at 45 degrees). gem_inside defaults to 0 and accepts negatives. profile picks a PEGHEAD_PROFILE asset by name (see ra.assets.list(“PEGHEAD_PROFILE”)); omitted = the default profile. element = name of a saved element (ra.elements.list) to start from; explicit arguments override it.
| Parameter | Type | |
|---|---|---|
gem_id | IdLike | required |
prongs | int | optional — None = the tool default |
height | float | optional — None = the tool default |
thickness | float | optional — None = the tool default |
girdle_width | float | optional — None = the tool default |
over_girdle_height | float | optional — None = the tool default |
gem_inside | float | optional — None = the tool default |
profile | str | optional — None = the tool default |
element | str | optional — None = the tool default |
ra.peghead.find()
ra.peghead.find(id: IdLike) -> Peghead
The handle for id, or None when the id does not belong to an object of this kind.
| Parameter | Type | |
|---|---|---|
id | IdLike | required |
ra.peghead.for_gem()
ra.peghead.for_gem(gem_id: IdLike) -> List[Peghead]
Peghead handles whose mother gem is gem_id (empty for None).
| Parameter | Type | |
|---|---|---|
gem_id | IdLike | required |
ra.peghead.selected()
ra.peghead.selected() -> List[Peghead]
Pegheads currently selected in the active doc.
Handles
Objects returned by the functions above. Assigning a settable property regenerates the object; the change is one undo step inside ra.transaction().
Peghead (handle)
| Property | Type | Settable | |
|---|---|---|---|
gem_carat_weight | float | ||
gem_inside | float | yes | |
gem_material | str | ||
gem_shape | str | ||
girdle_width | float | yes | |
height | float | yes | |
layer_name | str | ||
mother_gem_id | str | ||
object_type | str | ||
over_girdle_height | float | yes | |
position | Point3d | ||
profile_name | str | PEGHEAD_PROFILE asset name, "" when unset | |
prongs | int | yes | Current values (millimetres, except Prongs). negative = the rotated variant |
thickness | float | yes |
| Method | |
|---|---|
delete() | |
move(translation: VectorLike) | |
set_element(element: str) | Applies a saved Peghead element (ra.elements.list(“Peghead”)) to this peghead: its parameters replace the current ones, the mother gem stays, and the peghead regenerates in place (same Guid). |
set_profile(asset_name: str) | PEGHEAD_PROFILE asset name |
Plus what every handle has: id, delete(), update(**kwargs), parameters(), equality and hashing by id, and raw (the underlying .NET object).