Macros & Reuse
Macros are an advanced feature for packaging a sequence of cuts so you can replay it with a single command. While you can use them for simple repetition like a pavilion break, they are most powerful when defining complex gem outlines using the Centerpoint-Angle Method (CAM).
Anatomy of a macro
define macro Name(parameter = default, ...)
# Optional docstring lines that explain the intent.
STATEMENTS...
end macro
- Name – any identifier. The studio treats names case-insensitively.
- Parameters – always named (
key = valuewhen you call the macro). Defaults are optional. - Body – regular FSL statements. Use
${parameter}to inject values.
Inside the macro you can run set, let, assert, facet commands—anything you would normally write by hand. Once the macro ends, any temporary variables disappear.
Calling a macro
Invoke a macro with $Name(key = value, ...). Every argument is explicit, which keeps macros readable and avoids guessing which number corresponds to what.
$CrownRing(tier = "C1", angle = 32.5)
If you skip a parameter, the default from the definition (or inline placeholder) is used instead. Macros are also the best place to guard your design with assert statements—for example, to stop the interpreter if a caller passes an angle outside the safe range.
Full example
The snippet below defines a macro that cuts two crown rings and checks the parameters before it runs. Paste it into the studio and tweak the angles to see how the macro behaves.
set name "Macro Tour"
set gear 96
set girdle 3.5
P1 down 0 @ 41.8 : 0.18 x8
P2 down 6 @ 39.4 : mp(P1) x8
G1 0 @ 90 : size x16
let crown_target = mp(G1)
define macro CrownRing(tier, angle = 32.0, target = crown_target)
# Validate the inputs before cutting
assert ${angle} > 0 "Crown angle must be positive"
assert ${angle} < 35 "Keep crown angles below 35 degrees"
${tier} up 0 @ ${angle} : ${target} + girdle x16
end macro
$CrownRing(tier = "C1", angle = 32.4)
$CrownRing(tier = "C2", angle = 28.6)
Use macros sparingly—just enough to remove repetition without hiding what the stone is doing. For everyday tips on statements and expressions, revisit the earlier chapters; for advanced point tricks, head to Facets and Tiers.
CAM system macros
The studio ships a handful of Centerpoint–Angle Method helpers so you can block in pavilion preforms without rewriting the same geometry. Every macro below is available automatically—just call it from any design, tweak the arguments, and continue cutting. For rendered outlines and meetpoint callouts, see the CAM section in Facets and Tiers.