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,
                        fitToGem = False, clearance = None)      # -> [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, % of gem height
heightCrown0 -> 34Crown section height, % of gem height
heightGirdle0 -> 3Girdle band, above and below the girdle outline, % of gem height
heightPavilion0 -> 71Depth of the pavilion cone tip below the girdle, % of gem 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
fitToGemFalseTrue computes gemInside, heightGirdle and heightPavilion gem by gem, so the cutter encloses the real stone. See Fit to gem
clearanceunset -> 0.05With fitToGem: the gap between the stone and the cutter, mm

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

Fit to gem

The panel and CutterApi build the same geometry. The size arguments scale the gem outline, and the pavilion is a straight cone from the girdle band to a single point heightPavilion % below it. On a round brilliant that cone follows the stone. On fancy cuts (cushion, oval, pear…) the real pavilion is convex, so the cone can sit inside the stone just below the girdle.

fitToGem = True solves this for every gem. It measures the gem’s real mesh and computes the three values that make the cutter enclose the girdle and pavilion with clearance mm:

  • gemInside grows until the girdle zone clears the outline.
  • heightGirdle extends the band down to the lowest point that still hugs the outline. It never goes below the value you gave.
  • heightPavilion deepens the cone until every pavilion vertex, and the culet, is covered.

The crown, top and drill are design choices, so they stay as given. The panel’s Fit to gem button does the same, and gives the same values.

from ArtisanPlugin.Scripting import CutterApi as cutter, Transaction

with Transaction.Begin("Cutters for the fancy cuts"):
    cutters = cutter.Create(gemIds, fitToGem = True, clearance = 0.08)

Edit

Create, Find and All return an ICutter handle. Its setters regenerate the cutter in place, keeping the same id. Unlike Create, they take literal values, so 0 is a real zero:

MemberMeaning
SizeTop / SizeBottom / SizeDrillThe three widths, % of gem size. Setters: SetSizeTop, SetSizeBottom, SetSizeDrill
HeightTop / HeightCrown / HeightGirdle / HeightPavilion / HeightDrillThe section heights, %. Setters: SetHeightTop… SetHeightDrill (0 = no drill body)
GemInsideMillimetres added to the gem outline. Setter: SetGemInside (signed)
DrillType0 gem shape, 1 round, 2 square, 3 hexagon. Setter: SetDrillType
FitToGem(clearance = None)Refits GemInside, HeightGirdle and HeightPavilion to this cutter’s gem, with a default clearance of 0.05 mm
GemShape / GemMaterial / GemCaratWeightThe gem this cutter was built for
Id / MotherGemId / ObjectType / LayerName / PositionThe structural surface

Move(vector) and Delete() are available too. Wrap mutations in a Transaction.

from ArtisanPlugin.Scripting import CutterApi as cutter, Transaction

with Transaction.Begin("Refit the selected cutters"):
    for c in cutter.Selected():
        c.FitToGem(0.05)
        print(c.GemShape, c.GemInside, c.HeightPavilion)

Through MCP, create_cutters takes fit_to_gem and clearance, and edit_object {"fit_to_gem": true} refits an existing cutter.

Queries

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