134 lines
4.9 KiB
OpenSCAD
134 lines
4.9 KiB
OpenSCAD
|
include <common.scad>
|
||
|
include <AluTCommon.scad>
|
||
|
|
||
|
semitone_strings = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "X", "XI"];
|
||
|
octave_strings = ["", "˙", "¨", "¯"];
|
||
|
octave_scales = [1.1, 1, 0.9, 0.8];
|
||
|
|
||
|
// $fn = $preview ? 32 : 512;
|
||
|
// mink_fn = $preview ? 12 : 128;
|
||
|
// mink_fn_2d = $preview ? 32 : 256;
|
||
|
$fn = 32;
|
||
|
mink_fn = 12;
|
||
|
mink_fn_2d = 32;
|
||
|
|
||
|
fret_width = 2.4; //2.8; // Jumbo = 0.11", 0.055" tall
|
||
|
tube_radius = Cap_Spine + T_circumcenter[0];
|
||
|
|
||
|
|
||
|
module tube(from_fret, to_fret, scale_offset = 0) {
|
||
|
function fsl(fret_number) = fret_scale_length(fret_number + scale_offset);
|
||
|
z_min = (fsl(to_fret) + fsl(to_fret+1))/2;
|
||
|
z_max = (fsl(from_fret) + fsl(from_fret-1))/2;
|
||
|
z_offset = z_min;
|
||
|
Cap_Length = z_max - z_min;
|
||
|
echo(str("Cap length from fret ", from_fret, " to ", to_fret, " is ", Cap_Length, "mm"));
|
||
|
|
||
|
module solid_tube(cap_taper = 1.5, fingerboard_min_thick = 2.5, fingerboard_max_thick = 5, fret_angle = 60) { // Fret angle of 45° is normal, anything over 60 will not work correctly
|
||
|
module cap_outline(profile_radius_scale = 1.0, rounding_radius = 1.5) {
|
||
|
minkowski($fn = mink_fn_2d) {
|
||
|
circle(r = rounding_radius);
|
||
|
difference() {
|
||
|
translate([(profile_radius_scale-1.0)*tube_radius, 0, 0]) translate(T_circumcenter) circle(r = tube_radius*profile_radius_scale - rounding_radius);
|
||
|
translate([fingerboard_max_thick - rounding_radius, -50]) square([100,100]);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
module fret_bumps(w=100) {
|
||
|
translate([0,0,-z_offset]) for (fret = [from_fret:to_fret])
|
||
|
translate([fingerboard_max_thick - fret_width/2, w/2, fsl(fret)])
|
||
|
rotate([90,0,0]) cylinder(h = w, r = fret_width/2);
|
||
|
}
|
||
|
|
||
|
module scallops(w=100) {
|
||
|
for (fret = [from_fret:to_fret+1])
|
||
|
let(
|
||
|
f_prev = fsl(fret-1) - z_offset,
|
||
|
f_next = fsl(fret) - z_offset,
|
||
|
o = fret_width/2 * sin(fret_angle),
|
||
|
x0 = f_prev - o,
|
||
|
x1 = f_next + o,
|
||
|
y0 = fingerboard_min_thick,
|
||
|
y1 = fingerboard_max_thick - (fret_width/2 * cos(fret_angle)),
|
||
|
pts = [[x0, y1], [x1, y1], [(x0+x1)/2, y0]],
|
||
|
cc = tri_circumcenter(pts),
|
||
|
r = norm([x0, y1] - cc)
|
||
|
) {
|
||
|
translate([0,-w/2,0])
|
||
|
rotate([-90,-90,0])
|
||
|
translate(cc) cylinder(h = w, r = r);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
module basic_fretboard() {
|
||
|
intersection() {
|
||
|
// hull() {
|
||
|
// minkowski($fn = mink_fn) {
|
||
|
// sphere(cap_taper, $fn = mink_fn);
|
||
|
// translate([0,0,cap_taper]) linear_extrude(0.01) offset(-cap_taper)
|
||
|
// cap_outline(fingerboard_min_thick = fingerboard_min_thick, fingerboard_max_thick = fingerboard_max_thick);
|
||
|
// }
|
||
|
// minkowski($fn = mink_fn) {
|
||
|
// sphere(cap_taper, $fn = mink_fn);
|
||
|
// translate([0,0,Cap_Length-cap_taper]) linear_extrude(0.01) offset(-cap_taper)
|
||
|
// cap_outline(fingerboard_min_thick = fingerboard_min_thick, fingerboard_max_thick = fingerboard_max_thick);
|
||
|
// }
|
||
|
// linear_extrude(Cap_Length) offset(-1) cap_outline();
|
||
|
// translate([0,0,cap_taper]) linear_extrude(Cap_Length-cap_taper*2)
|
||
|
// cap_outline(fingerboard_min_thick = fingerboard_min_thick, fingerboard_max_thick = fingerboard_max_thick);
|
||
|
// }
|
||
|
hull() {
|
||
|
translate([0,0,Cap_Length]) linear_extrude(0.001) cap_outline(1.0);
|
||
|
translate([0,0,0]) linear_extrude(0.001) cap_outline(1.75);
|
||
|
}
|
||
|
// linear_extrude(Cap_Length)
|
||
|
// cap_outline();
|
||
|
union() {
|
||
|
color("black") fret_bumps();
|
||
|
color("white", alpha=0.01) translate([-50,-50,0]) cube([50 + fingerboard_max_thick - (fret_width/2 * cos(fret_angle)), 100, Cap_Length]);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// Make a solid tube and then subtract the notches
|
||
|
difference() {
|
||
|
basic_fretboard();
|
||
|
difference() {
|
||
|
color("red") scallops();
|
||
|
color("blue") fret_bumps();
|
||
|
}
|
||
|
}
|
||
|
// color("red") scallops();
|
||
|
}
|
||
|
|
||
|
difference() {
|
||
|
solid_tube(1.5);
|
||
|
linear_extrude(Cap_Length) T_hole();
|
||
|
tapered_T_hole(z0 = 0, z1 = 3);
|
||
|
tapered_T_hole(z0 = Cap_Length-3, z1 = Cap_Length+0.0001, o0 = 0, o1 = 1);
|
||
|
// Version number
|
||
|
translate([-10,10,Cap_Length-0.5]) linear_extrude(1) text("06", size=5, halign="center", valign="center", font="Noto Sans");
|
||
|
// Fret number markers
|
||
|
color("black")
|
||
|
for (fret = [from_fret:to_fret])
|
||
|
translate([-3,-16,fsl(fret)-z_offset]) rotate([90,25,16]) linear_extrude(40) {
|
||
|
octave = floor(fret/12);
|
||
|
semitone = fret%12;
|
||
|
octave_scale = octave_scales[octave];
|
||
|
|
||
|
text(semitone_strings[semitone], size=4*octave_scale, halign="center", valign="center", font="Noto Sans");
|
||
|
text(octave_strings[octave], size=6*octave_scale, halign="center", valign="center", font="Noto Sans");
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
tube(from_fret = 0, to_fret = 36, scale_offset = -5);
|
||
|
//translate([50, 0]) tube(from_fret = -4, to_fret = -3);
|
||
|
//translate([100, 0]) tube(from_fret = -2, to_fret = 0);
|
||
|
//translate([150, 0]) tube(from_fret = 1, to_fret = 3);
|
||
|
//translate([200, 0]) tube(from_fret = 4, to_fret = 7);
|
||
|
//translate([250, 0]) tube(from_fret = 8, to_fret = 12);
|
||
|
//translate([300, 0]) tube(from_fret = 13, to_fret = 19);
|
||
|
//translate([350, 0]) tube(from_fret = 20, to_fret = 30);
|