guitar

3D printable guitar parts
git clone https://git.woozle.org/neale/guitar.git

Neale Pickett  ·  2026-03-01

nut.scad

 1include <BOSL2/std.scad>
 2
 3size = [34, 4.2, 7.4]; // Size of the nut.
 4depth = 1; // How deep the notches should be. You can always file down further!
 5stringsPerCourse = 2; // How many strings in a course? Western guitar has 1, mandolin has 2.
 6strings = [12, 12, 18, 18, 35, 35, 45, 45]; // String gauges (diameter in mils)
 7gap = 0.5; // Space between outer edge of strings in a course, percentage of spacing between strings
 8
 9numStrings = len(strings);
10numCourses = numStrings / stringsPerCourse;
11stringDiameters = strings * 25.4 / 1000;
12
13totalStringSize = sum(stringDiameters);
14totalSpaceSize = size.x - totalStringSize;
15
16// Each course has padding space on each side, and gap space between strings.
17// Each course gets totalSpaceSize/numCourses space:
18
19// 2*padding + (gap*padding*stringsPerCourse) = totalSpaceSize / numCourses
20// padding * (2 + gap*stringsPerCourse) = totalSpaceSize / numCourses
21padding = totalSpaceSize / numCourses / (2 + (gap*stringsPerCourse));
22gapPadding = padding * gap;
23
24difference() {
25  $fn = 180; // 180 faces per complete circle is good enough for printing
26
27  // this is the part you'd buy from the supply store
28  intersection() {
29    cube(size, anchor=BACK+BOTTOM+LEFT);
30    rotate([0, 90, 0]) cylinder(h=size.x, r=size.z);
31  }
32
33  // this is the initial groove filing you'd pay extra for
34  space = size.y / numStrings / 2;
35  for (i = [0 : numStrings-1]) {
36    d = stringDiameters[i];
37    courseNo = floor(i / stringsPerCourse);
38    courseItem = (stringsPerCourse > 0) ? (i % stringsPerCourse) : 0;
39
40    stringsOffset = sum([for (s = [0:i]) stringDiameters[i]]);
41    xOffset = courseNo * (padding*2 + gap*stringsPerCourse) + stringsOffset;
42    x = xOffset + padding + (courseItem * padding * gap);
43
44    translate([x, 0, size.z-depth+d/2]) {
45      rotate([90-5, 0, 0]) {
46        hull() {
47          translate([0, 0, 0]) cylinder(h=size.z*2, d1=d*1.5, d2=d, center=true);
48          translate([0, 2, 0]) cylinder(h=size.z*2, d=d*2, center=true);
49        }
50      }
51    }
52  }
53}