Parametric CNC routing template generator for electric guitar bodies, written in OpenSCAD.
You supply a body outline SVG and a handful of caliper measurements, and grout generates DXF files ready to send to a CNC router or laser cutter. It handles neck pockets, pickup cavities, bridge routing, and hardware hole patterns — all positions derived from the actual dimensions of the parts you are installing.
Understanding the geometry behind grout makes it much easier to use. This section explains why the system works the way it does and how to think about your own builds.
A stringed instrument is fundamentally a precision measurement device. The string vibrates between two fixed endpoints — the nut and the bridge saddle. The distance between them is the scale length. Frets divide that distance according to a mathematical formula, and their positions are not arbitrary: they are exact fractions of the scale length, derived from the physics of how a vibrating string produces pitch.
Because of this, every spatial relationship on a guitar body is downstream of one number: the scale length. Get the scale length right and everything else falls into place. Get it wrong by even a few millimeters and the instrument will never intonate correctly — the open strings will be in tune but fretted notes will be sharp or flat across the whole neck.
Western music uses equal temperament: each semitone is an equal frequency ratio. The ratio is the twelfth root of two, because twelve semitones make one octave and an octave doubles the frequency.
For a vibrating string, frequency is inversely proportional to vibrating length. This means each fret reduces the vibrating length by the same factor:
vibrating_length_at_fret_N = scale_len / 2^(N/12)
That expression — scale_len / 2^(N/12) — is the distance from fret N to the bridge. It is the single most important formula in lutherie, and it is what grout uses to derive every position in the layout.
A few useful values for a 25.5" (647.7mm) scale:
| Fret | Distance to bridge (mm) | Notes |
|---|---|---|
| 12 | 323.9 (scale/2) | Octave above open string |
| 17 | 242.7 | Common Fender body joint area |
| 20 | 204.0 | Reference fret used in neck_strat module |
| 22 | 181.7 | Last fret on many Fender-style necks |
| 24 | 161.9 | Last fret on extended-range/shred necks |
The formula works for any scale length: just substitute your value. This is why grout can generate a correct layout for a 24.75" Gibson-scale neck or a 25.5" Fender-scale neck using the same body outline — only the numbers change.
Once you fix the scale length, you have one remaining question: where does the neck sit on the body?
This is a single degree of freedom. You can express it in several equivalent ways:
- How far the nut is from the top edge of the body
- How far the heel end of the neck is from the bridge
- Which fret number sits at the pocket opening
Grout uses the third framing — joint_fret — because it is the most musically and physically meaningful. It directly expresses your design intent for upper-fret access, and it is the conventional way luthiers describe neck joint geometry.
Fixing joint_fret determines the bridge position. Once the neck is placed so that a specific fret is at the pocket opening, the bridge must be at exactly scale_len / 2^(joint_fret/12) past that point. There is no other choice. The string length from nut to bridge is fixed by scale length; where the fret sits on the body is fixed by joint_fret; therefore the bridge position is fully determined.
This is the round-trip property of the system: you can change either the neck (different scale length, different heel geometry) or the layout intent (different joint_fret) independently, and the bridge position will update automatically to remain correct.
A common approach in traditional lutherie is to establish the bridge position first and build the neck joint around it. This makes sense when you are building a specific instrument from scratch with known parts and a fixed design.
Grout is designed for a different workflow: buying an off-the-shelf neck and fitting it to a custom body. In this case the neck is the input variable, not the output. You buy a neck with a specific scale length and heel geometry, and you want the body template to accommodate it correctly regardless of whether you use a 25.5" Fender neck this time or a 24.75" Gibson-scale neck next time.
Using the bridge as the anchor would require you to re-derive the neck pocket position every time you change necks. Using joint_fret as the anchor means the neck pocket position stays consistent (it is always at the same place on the body contour), and the bridge moves to wherever it needs to be. On a routed body, moving the bridge a few millimeters is not a problem — you drill the bridge holes after routing anyway.
All positions in grout are measured from a single origin point: the heel end of the neck pocket — the bridge-side wall of the pocket, at the centerline of the body.
nut end of neck
│
│ neck (not shown — extends above body)
│
════════╪════════ ← body top edge / pocket opening Y = +pocket_depth
│
║ │ ║ ← neck pocket walls
║ │ ║
║ │ ║
╚═══════╪═══════╝ ← heel end of pocket Y = 0 (ORIGIN)
│
│ body (bridge, pickups, controls)
│
─ ─ ─ ─┼─ ─ ─ ─ ← neck pickup Y = negative
│
─ ─ ─ ─┼─ ─ ─ ─ ← bridge pickup Y = more negative
│
══════╪══════ ← bridge Y = most negative
│
Positive Y is toward the nut. Negative Y is toward the bridge.
The bridge Y position is computed as:
bridge_y = pocket_depth - fret_to_bridge(scale_len, joint_fret)
This works because:
- The pocket opening (where
joint_fretsits) is at+pocket_depthfrom the origin - The bridge is
fret_to_bridge(scale_len, joint_fret)mm past the pocket opening toward the bridge - So
bridge_y = pocket_depth - fret_to_bridge(scale_len, joint_fret)
For typical values (scale_len=635, joint_fret=16, pocket_depth=88.9mm):
fret_to_bridge(635, 16) = 635 / 2^(16/12) = 635 / 2.520 = 252mm
bridge_y = 88.9 - 252 = -163mm
The bridge is 163mm toward the tail from the heel end of the pocket.
1. scale_len — from the neck
The full scale length in mm, from nut to bridge saddle. This is usually stamped on the headstock or listed in the product spec sheet. If you need to measure it: place the neck face-up on a flat surface and measure from the nut face to the 12th fret, then double it. (The 12th fret is at exactly half the scale length.)
2. fret_offset — from the neck
The distance from the heel end (bridge-side flat face) of the neck to the center of the 20th fret slot. Lay the neck face-down. Set your calipers to reach from the flat heel end to the 20th fret slot. Write down this number in mm.
flat heel face
│
│←── fret_offset ──→│
│ 20th fret slot
│ │
└───────────────────┘
heel
This measurement tells grout exactly where the 20th fret (the internal reference point of the neck pocket module) sits relative to the pocket's body-end wall. It varies by manufacturer and neck model.
3. pocket_depth — from your body blank or spec sheet
The length of the neck pocket along the neck axis, from the heel-end wall to the pocket opening at the body surface. Measure this in your body blank with calipers. Common values:
- 76mm (3.0"): typical for many production Fender-style bodies
- 88.9mm (3.5"): some aftermarket and custom body specs
Pickup positions are expressed as distance from the bridge, in mm. This is the standard luthier convention and directly affects tone: pickups closer to the bridge emphasize high harmonics and produce a brighter sound; pickups farther from the bridge (closer to the neck) emphasize the fundamental and produce a warmer, fuller sound.
Typical ranges:
- Neck pickup: 130–180mm from bridge
- Bridge pickup: 50–80mm from bridge
These are starting points. Professional guitar makers use specific positions that they have validated by ear over many builds. For a first build, use the middle of the typical range and adjust on subsequent builds.
In grout, pickup Y positions are computed as:
neck_pickup_y = bridge_y + neck_pickup_dist
bridge_pickup_y = bridge_y + bridge_pickup_dist
Because bridge_y is derived from scale length and joint_fret, the pickups move automatically when you change either. On a longer scale neck the bridge moves further from the pocket, and the pickups (which stay a fixed distance from the bridge) move with it.
The body outline SVG must share the same coordinate origin as the grout layout: (0, 0) at the heel end of the neck pocket, center of the body width.
This is a one-time setup step when you prepare your body SVG. In Inkscape:
- Draw or trace your body outline.
- Draw a small construction cross or dot at the point that will be the heel end of the neck pocket — on the centerline of the body, at the bridge-side wall of the pocket.
- Select the entire drawing and use Object → Transform (or the X/Y fields in the toolbar) to move the drawing so that construction point is at exactly (0, 0).
- Delete the construction mark and export as Plain SVG.
Once the SVG origin is set this way, you never need to touch it again. Changing scale length, joint_fret, or any other parameter in example.scad will correctly reposition all routing features relative to the fixed body shape.
- OpenSCAD 2021.01 or later (command-line rendering required)
- Calipers (digital are easiest)
- Inkscape for preparing the body SVG
- A CNC router or laser cutter to use the output DXFs
git clone https://github.com/youruser/grout.git
cd grout
bash symlink-install.shThis symlinks grout into OpenSCAD's user library path (~/.local/share/OpenSCAD/libraries), so any .scad file can import it with use <grout/grout.scad>.
See "The SVG body outline and coordinate alignment" in the Theory section above. The key requirement: origin at the heel end of the neck pocket, centered on the body.
If you are tracing an existing guitar body or paper template:
- Scan at 150–300 DPI.
- Open in Inkscape, trace with Path → Trace Bitmap or the Bezier tool.
- Verify scale: draw a known-dimension rectangle alongside and compare pixels to mm.
- Set the origin as described above.
- Export as Plain SVG.
The neck drives everything. You need three numbers:
| What | How to get it |
|---|---|
scale_len |
Spec sheet, headstock stamp, or double the nut-to-12th-fret distance |
fret_offset |
Calipers: flat heel face to 20th fret slot |
pocket_depth |
Calipers: measure the pocket in your body blank |
This is your primary design decision. It controls how far the neck reaches into the body.
- Shallower joint (lower number, e.g. 14–16): More neck overhangs the body. The bridge lands further from the neck pocket. Common on Telecaster and some LP-style builds.
- Deeper joint (higher number, e.g. 17–22): Less neck overhang. The bridge lands closer to the neck pocket. Required for upper-fret access on instruments with 22+ frets and deep cutaways.
After choosing joint_fret, grout computes exactly where the bridge must go. If that position doesn't suit your body shape, adjust joint_fret by 1–2 frets and re-render — the bridge will shift by roughly 10–20mm per fret at typical scale lengths.
// Your neck:
scale_len = 647.7; // 25.5" Fender standard
fret_offset = 31.0; // your caliper measurement
pocket_depth = 76.0; // 3" — measured in your body blank
// Your design intent:
joint_fret = 16; // fret at pocket opening
// Pickup positions (distance from bridge, in mm):
neck_pickup_dist = 155;
bridge_pickup_dist = 65;Open example.scad in the OpenSCAD GUI. Press F5 (preview) to see the layout over the body outline. Check that:
- The neck pocket sits in the right area of the body
- The bridge landing looks reasonable
- The pickups are in the right zone
Adjust joint_fret or pickup distances as needed and re-preview.
bash generate.shWrites to out/:
test-template.dxf— full routing template (body outline with cavities)test-slug.dxf— removable neck pocket insert
Print the DXF at 1:1 scale and check all dimensions with calipers before routing anything. Key checks:
- Neck pocket width matches neck heel width (should be snug with ~0.1mm clearance)
- Bridge position makes sense on the body
- Pickup cavity centers are where you expect them
This is where the parametric approach pays off. To try a different neck on the same body outline:
- Change
scale_lenandfret_offsetinexample.scadto match the new neck. - Keep
joint_fretthe same (same pocket opening location on the body). - Re-render.
The bridge will move to the correct position for the new scale. All routing features update automatically. The only physical constraint is whether there is enough wood at the new bridge location for solid post/saddle mounting.
Two layouts are included in grout.scad:
| Module | Bridge type | Typical use |
|---|---|---|
jazz_layout |
Jazzmaster floating bridge | Offset guitars, Jazzmaster/Jaguar builds |
tuneomatic_layout |
Tune-o-matic posts + tailpiece | Les Paul / SG style, hardtail builds |
Switch layouts by replacing jazz_layout(...) with tuneomatic_layout(...) in example.scad. All parameters are identical between the two.
Parts are 2D OpenSCAD modules defined in parts.scad. Each part is centered at its own origin. To add a new part:
- Measure all relevant dimensions with calipers.
- Add a module to
parts.scadusingrnd_rect_ctr(w, h, r)for rectangular cavities andcircle(d=...)for holes. - Add it to the layout in
grout.scadwithtranslate([0, bridge_y + offset]) your_part()to position it relative to the bridge.
Example — adding a P-90 pickup:
module pickup_p90() {
w = 82;
h = 42;
router_d = 6;
screw_d = locating_hole_dia;
screw_w = 95;
screw_h = 42;
rnd_rect_ctr(w, h, router_d);
translate([-screw_w/2, screw_h/2]) circle(d=screw_d);
translate([ screw_w/2, screw_h/2]) circle(d=screw_d);
translate([ screw_w/2, -screw_h/2]) circle(d=screw_d);
translate([-screw_w/2, -screw_h/2]) circle(d=screw_d);
}After running symlink-install.sh, any OpenSCAD file on your system can import grout:
use <grout/grout.scad>
jazz_layout(
scale_len = 647.7,
joint_fret = 16,
fret_offset = 31.0,
neck_pickup_dist = 155,
bridge_pickup_dist = 65,
pocket_depth = 76,
slug = false
);| File | Purpose |
|---|---|
example.scad |
Top-level driver — set your measurements here |
grout.scad |
Layout modules and the fret_to_bridge function |
parts.scad |
Individual hardware part modules |
primitives.scad |
Low-level geometry (rnd_trap, rnd_rect_ctr) |
strat-body-outline.svg |
Included Stratocaster body outline |
generate.sh |
Builds both DXF outputs in one command |
symlink-install.sh |
Installs grout as an OpenSCAD library |
All hardware modules have a mark parameter (default true). When mark = true, screw and mounting holes are rendered at 3mm diameter — sized for a standard transfer punch. Drill through your template into the body blank to mark all hole centers before routing.
To render actual-size holes instead (for reference):
neck_strat_plate(mark = false);slug is undefined when opening in the GUI
OpenSCAD requires slug to be passed on the command line. Use Design → Customize in the GUI to set it, or pass -D slug=false when rendering from the command line. The generate.sh script handles this automatically.
Body outline and routing features don't align The SVG origin is not at the heel end of the neck pocket. See "The SVG body outline and coordinate alignment" in the Theory section. Re-export the SVG with the correct origin.
Bridge position looks wrong for my body shape
Adjust joint_fret up or down by 1–2 frets. Each fret step moves the bridge approximately 10–20mm (more at the nut end, less at the bridge end — the fret spacing is not linear). Re-render and check the preview.
Pickup cavities overlap the neck pocket
neck_pickup_dist is too large for the chosen joint_fret. Either reduce neck_pickup_dist or increase joint_fret (deeper neck joint, more room between pocket and bridge).
Dimensions look wrong in the DXF OpenSCAD exports DXF in mm. Confirm that your CAM software or DXF viewer imports in mm, not inches.
SVG doesn't appear in OpenSCAD OpenSCAD requires Plain SVG, not Inkscape SVG. In Inkscape: File → Save a Copy → Plain SVG.