.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 | |
|---|---|
All | IPeghead handles for every object of this kind in the active document (empty when there is no document). |
ByLayer | IPeghead 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 null when the id does not belong to an object of this kind. |
ForGem | IPeghead handles whose mother gem is gemId (empty for Guid.Empty). |
Selected | Pegheads 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).
| Parameter | Type | Default |
|---|---|---|
layerName | string | required |
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.
| Parameter | Type | Default |
|---|---|---|
gemId | Guid | required |
prongs | int | 0 |
height | double | 0 |
thickness | double | 0 |
girdleWidth | double | 0 |
overGirdleHeight | double | 0 |
gemInside | double | double.NaN |
profile | string | null |
element | string | null |
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.
| Parameter | Type | Default |
|---|---|---|
id | Guid | required |
Returns IPeghead.
ForGem
IReadOnlyList<IPeghead> PegheadApi.ForGem(Guid gemId)
IPeghead handles whose mother gem is gemId (empty for Guid.Empty).
| Parameter | Type | Default |
|---|---|---|
gemId | Guid | required |
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.
| Property | Type | ||
|---|---|---|---|
GemCaratWeight | double | get | (from IGemSetting) |
GemInside | double | get | |
GemMaterial | string | get | (from IGemSetting) |
GemShape | string | get | (from IGemSetting) |
GirdleWidth | double | get | |
Height | double | get | |
Id | Guid | get | (from IParametricObject) |
LayerName | string | get | (from IParametricObject) |
MotherGemId | Guid | get | (from IParametricObject) |
ObjectType | string | get | (from IParametricObject) |
OverGirdleHeight | double | get | |
Position | Point3d | get | (from IParametricObject) |
ProfileName | string | get | PEGHEAD_PROFILE asset name, "" when unset |
Prongs | int | get | Current values (millimetres, except Prongs). negative = the rotated variant |
Thickness | double | get |
| 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) |