.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,
double thicknessBottom = 0,
double prongRotation = double.NaN,
bool? seat = null,
double seatAngle = 0,
bool? galleryRail = null,
double galleryPosition = 0,
double galleryHeight = 0,
double galleryWidth = 0)
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. thicknessBottom tapers the prongs: thickness is the one at the top and this the one at the bottom of the peghead (0 = the same, no taper). prongRotation turns the prongs around the axis of the stone, in degrees from the positions the shape gives them (counter-clockwise seen from above; default 0). seat true cuts the seat of the stone into the prongs: what the stone occupies is taken out of them, straight above the girdle and at seatAngle below it (degrees from the girdle plane, default 41). It shows where the stone sits inside the prongs (gemInside above 0). galleryRail true adds a rail around the peghead, under the stone, that ties the prongs together: galleryPosition mm below the girdle (0 = a little above the middle of the body), galleryHeight high and galleryWidth wide (0 = 0.8 mm each). 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 |
thicknessBottom | double | 0 |
prongRotation | double | double.NaN |
seat | bool? | null |
seatAngle | double | 0 |
galleryRail | bool? | null |
galleryPosition | double | 0 |
galleryHeight | double | 0 |
galleryWidth | double | 0 |
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 | ||
|---|---|---|---|
GalleryHeight | double | get | |
GalleryPosition | double | get | The gallery rail, in mm: how far below the girdle its middle is (0 = a little above the middle of the body), its height and its width. |
GalleryRail | bool | get | True when the peghead has a gallery rail tying the prongs together. |
GalleryWidth | double | get | |
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 |
ProngRotation | double | get | Degrees the prongs are turned around the axis of the stone, from the positions the shape gives them (counter-clockwise from above). |
Prongs | int | get | Current values (millimetres, except Prongs). negative = the rotated variant |
Seat | bool | get | True when the seat of the stone is cut into the prongs. |
SeatAngle | double | get | Angle of the seat below the girdle, in degrees from the girdle plane. |
Thickness | double | get | |
ThicknessBottom | double | get | Thickness of the prongs at the bottom of the peghead, in mm (Thickness is the one at the top). 0 = the same: no taper. |
| 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 SetGalleryHeight(double galleryHeight) | Height of the gallery rail, in mm. |
void SetGalleryPosition(double galleryPosition) | How far below the girdle the middle of the gallery rail is, in mm. 0 = a little above the middle of the body. |
void SetGalleryRail(bool galleryRail) | Adds (true) or removes (false) the gallery rail, the ring under the stone that ties the prongs together. |
void SetGalleryWidth(double galleryWidth) | Width of the gallery rail, in mm, measured in from the outside of the peghead. |
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 SetProngRotation(double prongRotation) | Turns the prongs around the axis of the stone: degrees from the positions the shape gives them, counter-clockwise seen from above. |
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 SetSeat(bool seat) | Cuts (true) or removes (false) the seat of the stone in the prongs: what the stone occupies is taken out of them. It shows where the stone sits inside the prongs (GemInside above 0). |
void SetSeatAngle(double seatAngle) | Angle of the seat below the girdle: 10 to 80 degrees from the girdle plane (41 = a brilliant’s pavilion). |
void SetThickness(double thickness) | |
void SetThicknessBottom(double thicknessBottom) | Tapers the prongs: their thickness at the bottom of the peghead, in mm, Thickness staying the one at the top. 0 removes the taper. |