GuitarModels/GuitarFretboards.scad

182 lines
6.0 KiB
OpenSCAD
Raw Permalink Normal View History

2023-06-13 21:21:33 +09:30
// Fender standard is 25.5"
Guitar_Scale_Length_In = 25.5;
// Convert to mm (1" = 25.4mm)
//Guitar_Scale_Length_mm = Guitar_Scale_Length_In * 25.4;
// This conversion ends up with 647.7mm, but 648mm has nice round number 865mm on the -5 fret too! Regular P-bass is 864mm
Guitar_Scale_Length_mm = 648;
// Extending the Strat by 5 frets gives a P-Bass
Bass_Fret = -5;
PBass_Nut_Width_In = 1.625; // (43mm)
JBass_Nut_Width_In = 1.5; // (38mm)
Strat_Nut_Width_In = 1.65; // (42mm)
function fret_scale_length(n) = Guitar_Scale_Length_mm * 2^(-n/12);
function lerp(start, end, amount) = start + (end-start)*amount;
echo(str("Guitar scale length is ", fret_scale_length(0), "mm"));
echo(str("Bass scale length is ", fret_scale_length(Bass_Fret), "mm"));
// Our modules need to fit in our 25x20cm build area
// This can be obtained by [-5,0), [0,7), [7,19), [19,bridge] modules.
module radiused_chord(w, r, points=12) {
// w <= abs(r)*2
// Negative r possible for mirroring across y-axis
angle = asin(0.5*w/r);
angles = [
for (i = [0:points-1])
let (f = -0.5 + i/(points-1))
f * 2 * angle
];
x0 = r*cos(angle);
coords = [
for (th = angles)
let (
x = r*cos(th) - x0,
y = r*sin(th)
)
[x,y]
];
polygon(coords);
}
module c_text(s, size)
text(s, size=size, halign="center", valign="center", font="Noto Sans");
epsilon = 0.0001;
module to3d()
{linear_extrude(epsilon) children();}
nut_width = 38;
bridge_width = nut_width + 40;
fretboard_radius = 5.5*25.4;
neck_radius = 20;
color("red")
rotate([0,90]) hull(){
translate([0,0,fret_scale_length(Bass_Fret)/4])
to3d() radiused_chord(lerp(bridge_width, nut_width, 1/4), -fretboard_radius);
translate([0,0,fret_scale_length(Bass_Fret)])
to3d() radiused_chord(nut_width, -fretboard_radius);
}
// color("blue")
// rotate([0,90]) hull(){
// translate([0,-bridge_width/2,0])
// cube([20, bridge_width, 1]);
// translate([0,0,fret_scale_length(Bass_Fret)])
// to3d() scale([0.25,1]) radiused_chord(nut_width, neck_radius);
// }
module frets_and_markers(min_fret=-5, max_fret=36, width=bridge_width) {
// Fret wire placeholder model
for (x = [for (i = [min_fret:max_fret]) fret_scale_length(i)])
translate([x, -width/2, 0])
cube([1, width, 12]);
// Fret dots
for (octave = [0:3])
for (fret = [3, 5, 7, 9]) {
i = fret + (octave*12);
if (i > min_fret && i <= max_fret)
translate([(fret_scale_length(i)+fret_scale_length(i-1))/2,0,0])
//cylinder(h=10, r=4);
linear_extrude(10) c_text(str(fret), size=8);
}
// Octave markers
for (i = [0, 12, 24, 36]) if (i > min_fret && i <= max_fret) hull(){
translate([(fret_scale_length(i)+fret_scale_length(i-1))/2,20,0]) cylinder(h=10, r=3);
translate([(fret_scale_length(i)+fret_scale_length(i-1))/2,-20,0]) cylinder(h=10, r=1);
}
// Bass extension
if (min_fret < -1)
for (i = [min_fret+1:-1])
translate([(fret_scale_length(i)+fret_scale_length(i-1))/2,0,0])
linear_extrude(10) c_text(str(i), size=12);
}
Module_Length = 220; // Printer can do up to 250mm, the bass fret run is 217mm. Don't forget overlapping joins!
Module_Overhang = 20;
Module_Bridge_Offset = -15; //80 240
module Connector() {
translate([0,0,-15])
linear_extrude(10)
polygon([[0,5],[0,-5],[Module_Overhang,-15],[Module_Overhang,15]]);
}
module Body(thickness=20, width=90) {
color("blue", 0.5)
translate([Module_Bridge_Offset, -width/2, -thickness])
cube([Module_Length, width, thickness]);
frets_and_markers(20, 24);
translate([Module_Bridge_Offset+Module_Length, 0, 0]) Connector();
// Bridge
translate([-20, -bridge_width/2, 3])
cube([20, bridge_width, 10]);
}
module Neck1(thickness=18, width=70) {
color([0,0.5,1], 0.5)
translate([Module_Bridge_Offset+Module_Length, -width/2, -thickness])
cube([Module_Length, width, thickness]);
frets_and_markers(8, 20);
translate([Module_Bridge_Offset+Module_Length*2, 0, 0]) Connector();
}
module Neck2(thickness=17, width=60) {
color([0.5,0,1], 0.5)
translate([Module_Bridge_Offset+Module_Length*2, -width/2, -thickness])
cube([Module_Length, width, thickness]);
frets_and_markers(1, 7);
translate([Module_Bridge_Offset+Module_Length*3, 0, 0]) Connector();
}
module Neck_Bass(thickness=16, width=40) {
color([1,0,0.5], 0.5)
translate([Module_Bridge_Offset+Module_Length*3, -width/2, -thickness])
cube([Module_Length+Module_Overhang, width, thickness]);
frets_and_markers(-5, 0);
}
// Structural Aluminium
density_6063 = 2.7; // 6063 alloy is around 2.7g/cm3
echo(str("Weight of one 12mm x 3mm x 1m bar is ", density_6063*1.2*0.3*100, "g"));
echo(str("Weight of three 12mm x 3mm x 1m bar is ", density_6063*3.6*0.3*100, "g"));
echo(str("Weight of one 12x3 and two 10x3 x 1m bars is ", density_6063*3.2*0.3*100, "g"));
echo(str("Weight of one 12mm x 12mm x 1.5mm x 1m channel is roughly ", density_6063*1.2*0.15*100*3, "g"));
echo(str("Weight of one 16mm x 16mm x 1.5mm x 1m channel is roughly ", density_6063*1.6*0.15*100*3, "g"));
module Parallel_Bars(spacing=18, x0=-80) {
// for (y = [-1.5-spacing, -1.5, -1.5+spacing])
// translate([x0, y, -12]) cube([1000,3,12]); // 12mm x 3mm bar, 1m length
translate([x0, -1.5, -12]) cube([1000,3,12]); // 12mm x 3mm bar, 1m length
for (y = [-1.5-spacing, -1.5+spacing])
translate([x0, y, -10]) cube([1000,3,10]); // 12mm x 3mm bar, 1m length
}
module Alu_Channel(x0=-80) {
thickness = 1.5;
y0 = -thickness/2;
//12x12x1.5 channel
translate([x0, -6, -thickness]) cube([1000, 12, thickness]);
for (y = [y0-6, y0+6])
translate([x0, y, -12]) cube([1000, thickness, 12]);
}
// frets_and_markers(-5, 29);
Body(); Neck1(); Neck2();
Neck_Bass();
Parallel_Bars();
translate([0,150,0]) Body();
translate([0,250,0]) Neck1();
translate([0,150,0]) Neck2();
translate([0,250,0]) Neck_Bass();
translate([0,-150,0]) {
Body(); Neck1(); Neck2();
Alu_Channel();
}