Skip to content

Scripting API

Cutters

from ArtisanPlugin.Scripting import CutterApi as cutter

A cutter is the solid that opens the seat: the cone, the bearing and the drill hole a stone needs in order to sit in metal. You do not print the cutter - you build one per gem, then subtract them all from the piece with BooleanApi.Difference (see Gems) as the final “make it solid” step.

Cutters are built for a mother gem and stay linked to it. Unlike the other settings, Create works on a list of gems - or on the current selection - and returns one handle per gem, in input order.

Create

cutters = cutter.Create(gemIds = None, sizeTop = 0, sizeBottom = 0, sizeDrill = 0,
                        heightTop = 0, heightCrown = 0, heightGirdle = 0,
                        heightPavilion = 0, heightDrill = -1,
                        gemInside = None, drillType = -1)        # -> [ICutter]
ParameterDefaultMeaning
gemIdsNoneThe gems to cut. None or empty uses the gems currently selected
sizeTop0 -> 40Width of the cutter at the top, % of gem size
sizeBottom0 -> 40Width at the bottom, % of gem size
sizeDrill0 -> 40Width of the drill body, % of gem size
heightTop0 -> 100Height above the table, %
heightCrown0 -> 34Crown section height, %
heightGirdle0 -> 3Girdle section height, %
heightPavilion0 -> 71Pavilion section height, %
heightDrill-1 -> 200Drill body height, %. See below
gemInsideunsetMillimetres added to the gem outline; negative shrinks it
drillType-1 -> saved default0 gem shape, 1 round, 2 square, 3 hexagon

0 keeps the tool default, or your saved Cutter defaults when you have some - except for heightDrill, which uses -1 as “keep the default” because 0 is meaningful there: heightDrill = 0 disables the drill body entirely. drillType follows the same pattern with -1, and any value above 3 raises.

Passing no gems and having nothing selected raises; so does any id in gemIds that is not a gem. Each cutter gets its own copy of the parameter model with its own gem baked in, all the new cutters land on the primary object layer, and they are added to a single new group so you can grab them in one go.

from ArtisanPlugin.Scripting import CutterApi as cutter, BooleanApi as boolean, Transaction

with Transaction.Begin("Cut the seats"):
    cutters = cutter.Create(gemIds, sizeDrill = 55, drillType = 1)
    boolean.Difference([shankId], [c.Id for c in cutters])

Edit

Create, Find and All return an ICutter handle. It has no parametric setters: a cutter is read-only apart from Move(vector) and Delete(), both of which belong inside a Transaction. To change a dimension, delete the cutter and create it again.

What it exposes for reading:

MemberMeaning
SizeTop / SizeBottom / SizeDrillThe three widths, % of gem size
HeightTop / HeightCrown / HeightPavilion / HeightDrillThe section heights, %
GemInsideMillimetres added to the gem outline
DrillType0 gem shape, 1 round, 2 square, 3 hexagon
GemShape / GemMaterial / GemCaratWeightThe gem this cutter was built for
Id / MotherGemId / ObjectType / LayerName / PositionThe structural surface

Note that heightGirdle can be set at creation but is not exposed on the handle for reading.

from ArtisanPlugin.Scripting import CutterApi as cutter

for c in cutter.All():
    print(c.GemShape, c.SizeTop, c.HeightDrill, c.DrillType)

Queries

All(), Find(id), Count(), Selected(), ByLayer(name), ForGem(gemId).