first headpiece attempt

This commit is contained in:
Luke Hubmayer-Werner 2024-12-23 14:47:47 +10:30
parent 519ea53ecc
commit 818c75d6c4
1 changed files with 80 additions and 20 deletions

View File

@ -15,19 +15,21 @@ fret_inlays = [[3, "真"], [5, "尊"], [7, "正"], [9, "清"], [12, "評判"], [
module neck(string_spacing=18, string_margin=4.5, num_strings=3, target_neck_thickness=15, scallop_depth=3, num_frets=24, fret_width=2.4) {
neck_length = fret_scale_length(0)+fret_width/2;
fw2 = fret_width/2;
neck_length = fret_scale_length(0)+fw2;
neck_width = (num_strings-1)*string_spacing + string_margin*2;
// Could do some trig to work out exactly how much to add for the scallop depth, but we're subtracting anyway
angle_excess = 20;
module neck_stock() {
angle_excess = asin((scallop_depth+fw2)/target_neck_thickness);
a0 = 90-angle_excess;
a1 = 270+angle_excess;
rotate([-90, 0, 0])
linear_extrude(neck_length)
polygon([for (a = [90-angle_excess:1:270+angle_excess]) [neck_width*0.5*sin(a), -target_neck_thickness*cos(a)]]);
polygon([for (i = [0:300]) let(a=lerp(a0, a1, i/300.0)) [neck_width*0.5*sin(a), -target_neck_thickness*cos(a)]]);
}
module scallops() {
for (fret = [0:num_frets]) {
x0 = fret_scale_length(fret-1) - fret_width/2;
x1 = fret_scale_length(fret) + fret_width/2;
x0 = fret_scale_length(fret-1) - fw2;
x1 = fret_scale_length(fret) + fw2;
xmid = lerp(x0, x1, 0.5);
// Radius it?
arc = arc_points([[x0, scallop_depth], [x1, scallop_depth], [xmid, 0]]);
@ -101,21 +103,25 @@ module cf_tube(x1, x2, tolerance = 0.3) {
}
}
module cf_square(x1, x2, tolerance = 0.2) {
module cf_square(x1, x2, tolerance = 0.2, taper_x1 = true, taper_x2 = true) {
x = CF_Square_Width+tolerance;
translate([-x/2, x2, -x/2])
cube([x, x1-x2, x]);
hull() {
translate([0, x2, 0])
cube([x*1.2, 0.2, x*1.2], center=true);
translate([0, x2+5, 0])
cube([x, 0.2, x], center=true);
if (taper_x1) {
hull() {
translate([0, x1, 0])
cube([x*1.2, 0.2, x*1.2], center=true);
translate([0, x1-5, 0])
cube([x, 0.2, x], center=true);
}
}
hull() {
translate([0, x1, 0])
cube([x*1.2, 0.2, x*1.2], center=true);
translate([0, x1-5, 0])
cube([x, 0.2, x], center=true);
if (taper_x2){
hull() {
translate([0, x2, 0])
cube([x*1.2, 0.2, x*1.2], center=true);
translate([0, x2+5, 0])
cube([x, 0.2, x], center=true);
}
}
}
@ -143,8 +149,62 @@ module fret_tube(from_fret, to_fret, fret_width=2.4) {
}
}
module headpiece(string_spacing=18, string_margin=4.5, num_strings=3, target_neck_thickness=15, scallop_depth=3, fret_width=2.4) {
headpiece_length = 36;
cf_square_length = 32;
fw2 = fret_width/2;
x0 = fret_scale_length(0)+fw2;
neck_width = (num_strings-1)*string_spacing + string_margin*2;
bend_radius = 24;
module stock() {
angle_excess = asin(scallop_depth/target_neck_thickness);
a0 = 90-angle_excess;
a1 = 270+angle_excess;
translate([0, x0, 0])
rotate([-90, 0, 0])
linear_extrude(headpiece_length)
polygon([for (i = [0:300]) let(a=lerp(a0, a1, i/300.0)) [neck_width*0.5*sin(a), -target_neck_thickness*cos(a)]]);
}
module string_tubes() {
string_thicknesses = [4.9, 4.2, 3.0];
module string_tube(diameter, fn=36) {
hole_r = diameter/2;
bend_r = bend_radius + hole_r;
union() {
for (a = [0:89]) {
hull() {
translate([0, bend_r*sin(a), bend_r*cos(a)]) sphere(hole_r, $fn=fn);
translate([0, bend_r*sin(a+1), bend_r*cos(a+1)]) sphere(hole_r, $fn=fn);
}
}
hull() {
translate([0, bend_r*sin(90), bend_r*cos(90)]) sphere(hole_r, $fn=fn);
translate([0, bend_r*sin(90), -target_neck_thickness]) sphere(hole_r, $fn=fn);
}
}
};
for (i = [0:num_strings-1]) {
string_diameter = string_thicknesses[i];
x = -neck_width/2 + string_margin + (i*string_spacing);
translate([x, x0+2, -target_neck_thickness+scallop_depth+fw2]) string_tube(string_diameter);
}
}
difference() {
stock();
string_tubes();
for (i = [-1:2:1])
translate([i*7.5, 0, -7])
cf_square(x0+cf_square_length, x0, taper_x1=false);
// αβγδεζ
translate([0, x0+headpiece_length, -5]) rotate([90, 0, 180]) linear_extrude(0.3, center=true) text(text = "01β.α", font = "Deja Vu Sans", halign = "center", valign = "center", size = 4);
}
}
echo(fret_scale_length(0) - fret_scale_length(8)); // 225.724
echo(fret_scale_length(8) - fret_scale_length(24)); // 240.335
//fret_tube(0, 8);
//translate([30, 0, 0])
fret_tube(8, 24);
// fret_tube(0, 8);
// //translate([30, 0, 0])
// fret_tube(8, 24);
headpiece();