guitar

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

Neale Pickett  ·  2026-03-14

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)
 7adjustments = [0, 0, 0, 0, 0, 0, 0, 0]; // String height adjustment (groove depth)
 8gap = 0.5; // Space between outer edge of strings in a course, percentage of spacing between strings
 9
10numStrings = len(strings);
11numCourses = numStrings / stringsPerCourse;
12stringDiameters = strings * 25.4 / 1000;
13
14totalSpace = size.x - sum(stringDiameters);
15
16// Each course has padding on each side, and gapPadding between strings.
17// Each course gets totalSpace/numCourses space.
18// gapPadding is padding * gap;
19//
20// 2*padding + (gapPadding*(stringsPerCourse-1)) = totalSpace / numCourses
21// 2*padding + (gap*padding*(stringsPerCourse-1)) = totalSpace / numCourses
22// padding * (2 + gap*(stringsPerCourse-1)) = totalSpace / numCourses
23padding = totalSpace / numCourses / (2 + (gap*(stringsPerCourse-1)));
24gapPadding = padding * gap;
25
26rotate([-90, 0, 0]) difference() {
27  $fn = 180; // 180 faces per complete circle is good enough for printing
28
29  // this is the part you'd buy from the supply store
30  intersection() {
31    cube(size, anchor=BACK+BOTTOM+LEFT);
32    rotate([0, 90, 0]) cylinder(h=size.x, r=size.z);
33  }
34
35  // this is the initial groove filing you'd pay extra for
36  for (i = [0 : numStrings-1]) {
37    d = stringDiameters[i];
38    courseNo = floor(i / stringsPerCourse);
39    courseItem = i % stringsPerCourse;
40
41    stringsOffset = (i>0) ? sum([for (s = [0:i-1]) stringDiameters[s]]) : 0;
42    paddingOffset = courseNo * padding*2;
43    gapPaddingOffset = courseNo * (gapPadding*(stringsPerCourse-1));
44    x = padding + paddingOffset + gapPaddingOffset + stringsOffset + (courseItem * gapPadding);
45
46    translate([x, 0, size.z-depth+d/2+adjustments[i]]) {
47      rotate([90+5, 0, 0]) {
48        hull() {
49          translate([d/2, 0, -0.1]) cylinder(h=size.y+2, d=d);
50          translate([d/2, 0, -0.1]) cylinder(h=size.y+2, d1=d, d2=d*1.5);
51          translate([d/2, 3, -0.1]) cylinder(h=size.y+2, d=d*2);
52        }
53      }
54    }
55  }
56}