Skip to content

.NET API

PegheadApi

Peghead seats under a stone: prongs, height, thickness.

from ArtisanPlugin.Scripting import PegheadApi

See also the guide, Gemsets › Peghead, and the Python package, ra.peghead.

Methods

Method
AllIPeghead handles for every object of this kind in the active document (empty when there is no document).
ByLayerIPeghead handles on the layer with the given full path (empty when the layer does not exist).
CountNumber of objects of this kind in the active document.
CreateBuilds a peghead (prong head) around an existing gem — the ArtisanPeghead tool, headless.
FindThe handle for id, or null when the id does not belong to an object of this kind.
ForGemIPeghead handles whose mother gem is gemId (empty for Guid.Empty).
SelectedPegheads currently selected in the active doc.

All

IReadOnlyList<IPeghead> PegheadApi.All()

IPeghead handles for every object of this kind in the active document (empty when there is no document).

Returns IReadOnlyList<IPeghead>.

ByLayer

IReadOnlyList<IPeghead> PegheadApi.ByLayer(string layerName)

IPeghead handles on the layer with the given full path (empty when the layer does not exist).

ParameterTypeDefault
layerNamestringrequired

Returns IReadOnlyList<IPeghead>.

Count

int PegheadApi.Count()

Number of objects of this kind in the active document.

Returns int.

Create

IPeghead PegheadApi.Create(
    Guid gemId,
    int prongs = 0,
    double height = 0,
    double thickness = 0,
    double girdleWidth = 0,
    double overGirdleHeight = 0,
    double gemInside = double.NaN,
    string profile = null,
    string element = null)

Builds a peghead (prong head) around an existing gem — the ArtisanPeghead tool, headless. gemId must be a gem in the active document; the peghead is a parametric child of that gem. Millimetres; 0 keeps the tool default (or the user’s saved defaults): height 5, thickness 1, girdleWidth 0.8, overGirdleHeight 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). gemInside defaults to 0 and accepts negatives. profile picks a PEGHEAD_PROFILE asset by name (see AssetsApi.List(“PEGHEAD_PROFILE”)); omitted = the default profile. element = name of a saved Peghead element (ElementsApi.List(“Peghead”)) to start from instead of the defaults; explicit arguments (profile included) override it.

ParameterTypeDefault
gemIdGuidrequired
prongsint0
heightdouble0
thicknessdouble0
girdleWidthdouble0
overGirdleHeightdouble0
gemInsidedoubledouble.NaN
profilestringnull
elementstringnull

Returns IPeghead.

Find

IPeghead PegheadApi.Find(Guid id)

The handle for id, or null when the id does not belong to an object of this kind.

ParameterTypeDefault
idGuidrequired

Returns IPeghead.

ForGem

IReadOnlyList<IPeghead> PegheadApi.ForGem(Guid gemId)

IPeghead handles whose mother gem is gemId (empty for Guid.Empty).

ParameterTypeDefault
gemIdGuidrequired

Returns IReadOnlyList<IPeghead>.

Selected

IReadOnlyList<IPeghead> PegheadApi.Selected()

Pegheads currently selected in the active doc.

Returns IReadOnlyList<IPeghead>.

Handles and sections

What the methods above hand back. A handle’s setters regenerate the object; wrap changes in a Transaction so they land as one undo step.

IPeghead

Handle — extends IGemSetting, IParametricObject.

PropertyType
GemCaratWeightdoubleget(from IGemSetting)
GemInsidedoubleget
GemMaterialstringget(from IGemSetting)
GemShapestringget(from IGemSetting)
GirdleWidthdoubleget
Heightdoubleget
IdGuidget(from IParametricObject)
LayerNamestringget(from IParametricObject)
MotherGemIdGuidget(from IParametricObject)
ObjectTypestringget(from IParametricObject)
OverGirdleHeightdoubleget
PositionPoint3dget(from IParametricObject)
ProfileNamestringgetPEGHEAD_PROFILE asset name, "" when unset
ProngsintgetCurrent values (millimetres, except Prongs). negative = the rotated variant
Thicknessdoubleget
Method
void Delete()(from IParametricObject)
void Move(Vector3d translation)(from IParametricObject)
void SetElement(string element)Applies a saved Peghead element (ElementsApi.List(“Peghead”)) to this peghead: its parameters replace the current ones, the mother gem stays, and the peghead regenerates in place (same Guid).
void SetGemInside(double gemInside)
void SetGirdleWidth(double girdleWidth)
void SetHeight(double height)
void SetOverGirdleHeight(double overGirdleHeight)
void SetProfile(string assetName)PEGHEAD_PROFILE asset name
void SetProngs(int prongs)Parametric edits — each regenerates the peghead in place (same Guid) and calls LicenseGate.RequireValid() first. Millimetres; prongs accepts negative counts for the rotated variant (-4 = 4 prongs at 45 degrees).
void SetThickness(double thickness)