Skip to content

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).

ParameterType
layer_namestrrequired

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.

ParameterType
gem_idIdLikerequired
prongsintoptional — None = the tool default
heightfloatoptional — None = the tool default
thicknessfloatoptional — None = the tool default
girdle_widthfloatoptional — None = the tool default
over_girdle_heightfloatoptional — None = the tool default
gem_insidefloatoptional — None = the tool default
profilestroptional — None = the tool default
elementstroptional — 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.

ParameterType
idIdLikerequired

ra.peghead.for_gem()

ra.peghead.for_gem(gem_id: IdLike) -> List[Peghead]

Peghead handles whose mother gem is gem_id (empty for None).

ParameterType
gem_idIdLikerequired

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)

PropertyTypeSettable
gem_carat_weightfloat
gem_insidefloatyes
gem_materialstr
gem_shapestr
girdle_widthfloatyes
heightfloatyes
layer_namestr
mother_gem_idstr
object_typestr
over_girdle_heightfloatyes
positionPoint3d
profile_namestrPEGHEAD_PROFILE asset name, "" when unset
prongsintyesCurrent values (millimetres, except Prongs). negative = the rotated variant
thicknessfloatyes
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).