Fix neck width scaling

This commit is contained in:
Luke Hubmayer-Werner 2024-04-02 13:38:10 +10:30
parent 0781e0c9a7
commit 011345c68d
1 changed files with 13 additions and 13 deletions

View File

@ -6,14 +6,10 @@ octave_strings = ["", "˙", "¨", "¯"];
octave_scales = [1.1, 1, 0.9, 0.8]; octave_scales = [1.1, 1, 0.9, 0.8];
z_resolution = $preview ? 0.5 : 0.1; z_resolution = $preview ? 0.5 : 0.1;
profile_arc_steps_backside = $preview ? 8 : 180; $fs = $preview ? 1 : 0.01;
profile_arc_steps_topside = $preview ? 8 : 20; $fa = $preview ? 5 : 0.1;
// $fn = $preview ? 32 : 512; profile_arc_steps_backside = $preview ? 8 : 360;
// mink_fn = $preview ? 12 : 128; profile_arc_steps_topside = $preview ? 8 : 60;
// 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 fret_width = 2.4; //2.8; // Jumbo = 0.11", 0.055" tall
zero_fret_width = fret_width*1.5; zero_fret_width = fret_width*1.5;
@ -22,13 +18,17 @@ fret_angle = 60; //Fret angle of 45° is normal, anything over 60 will not work
tube_radius = Cap_Spine + T_circumcenter[0]; tube_radius = Cap_Spine + T_circumcenter[0];
standard_profile_center_x = T_circumcenter[0]; standard_profile_center_x = T_circumcenter[0];
x_min = standard_profile_center_x - tube_radius; x_min = standard_profile_center_x - tube_radius;
standard_y_width = 26.4517; minimum_y_width = 26.4517;
standard_y_width = 28;
nut_spacing = 10;
bridge_spacing = 20;
y_width_extra_mm = standard_y_width - (2 * nut_spacing);
y_width_extra = y_width_extra_mm / (2 * nut_spacing);
module tube(from_fret, to_fret, scale_offset = 0, fingerboard_min_thick = 2.5, fingerboard_max_thick = 5) { module tube(from_fret, to_fret, scale_offset = 0, fingerboard_min_thick = 2.5, fingerboard_max_thick = 5) {
function fsl(fret_number) = fret_scale_length(fret_number + scale_offset); function fsl(fret_number) = fret_scale_length(fret_number + scale_offset);
z0 = fsl(0); z0 = fsl(0);
function get_desired_width_scale(z) = 2.0-(z/z0); function get_desired_width_scale(z) = let (spacing = 2.0-(z/z0)) (spacing + y_width_extra)/(1 + y_width_extra);
function get_desired_profile_radius(ws) = function get_desired_profile_radius(ws) =
let ( let (
x = fingerboard_max_thick, x = fingerboard_max_thick,
@ -73,7 +73,7 @@ module tube(from_fret, to_fret, scale_offset = 0, fingerboard_min_thick = 2.5, f
polygon(points = concat(topside_points_1, backside_points, topside_points_2)); polygon(points = concat(topside_points_1, backside_points, topside_points_2));
top_width = pt(a_topside_start)[1] * 2; top_width = pt(a_topside_start)[1] * 2;
echo(str("WScale=", width_scale, " PScale=", profile_radius_scale, " r=", profile_radius, " has top width of ", top_width, " divides to ", top_width/width_scale, " (goal is 26.4517)")); echo(WScale=width_scale, PScale=profile_radius_scale, r=profile_radius, TopWidth=top_width, StringSpacing=(top_width-y_width_extra_mm)/2, dv=top_width/width_scale, goal=standard_y_width);
} }
module fret_bumps(w=100) { module fret_bumps(w=100) {
translate([fingerboard_max_thick - fret_width/2, w/2, -z_offset + fsl(from_fret)]) translate([fingerboard_max_thick - fret_width/2, w/2, -z_offset + fsl(from_fret)])
@ -101,7 +101,7 @@ module tube(from_fret, to_fret, scale_offset = 0, fingerboard_min_thick = 2.5, f
) { ) {
translate([0,-w/2,0]) translate([0,-w/2,0])
rotate([-90,-90,0]) rotate([-90,-90,0])
translate(cc) cylinder(h = w, r = r); translate(cc) cylinder(h = w, r = r, $fn=max(8*ceil(r), 32));
} }
} }