diff --git a/CFTubes.scad b/CFTubes.scad index 92531cf..b4db99c 100644 --- a/CFTubes.scad +++ b/CFTubes.scad @@ -17,7 +17,7 @@ include // going with 良 for 21 fret_inlays = [[3, "真"], [5, "尊"], [7, "正"], [9, "清"], [12, "評判"], [15, "愛"], [17, "徳"], [19, "賛"], [21, "良"], [24, "主イエス"]]; -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, filler=false) { +module neck(string_spacing=18, string_margin=4.5, num_strings=3, target_neck_thickness=15, target_neck_thickness_additional_points=[], scallop_depth=3, num_frets=24, fret_width=2.4, filler=false) { fw2 = fret_width/2; neck_length = fret_scale_length(0)+fw2; neck_width = (num_strings-1)*string_spacing + string_margin*2; @@ -26,8 +26,24 @@ module neck(string_spacing=18, string_margin=4.5, num_strings=3, target_neck_thi a0 = 90-angle_excess; a1 = 270+angle_excess; rotate([-90, 0, 0]) - linear_extrude(neck_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)]]); // Ellipse + if (len(target_neck_thickness_additional_points) < 1) { + linear_extrude(neck_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)]]); // Ellipse + } else { + pts = flatten([[[neck_length, target_neck_thickness]], target_neck_thickness_additional_points]); + echo(pts); + for (i = [0:len(pts)-2]) { + pt0 = pts[i]; + pt1 = pts[i+1]; + echo(i, pt0, pt1); + render() hull() { + translate([0,0,pt0[0]]) linear_extrude(0.01) + polygon([for (i = [0:300]) let(a=lerp(a0, a1, i/300.0)) [neck_width*0.5*sin(a), -pt0[1]*cos(a)]]); // Ellipse + translate([0,0,pt1[0]]) linear_extrude(0.01) + polygon([for (i = [0:300]) let(a=lerp(a0, a1, i/300.0)) [neck_width*0.5*sin(a), -pt1[1]*cos(a)]]); // Ellipse + } + } + } } module scallop(fret) { x0 = fret_scale_length(fret-1) - fw2; @@ -354,8 +370,14 @@ module Nylon6String() { string_margin = 3; // +6 neck_width = string_spacing*(num_strings-1) + string_margin*2; scallop_depth = 2.5; - target_neck_thickness = 22; fret_width=2.4; + target_neck_thickness = 22; + echo(fret_scale_length(8)); + echo(fret_scale_length(9)); + // target_neck_thickness_additional_points = [[480, 22], [440, 30], [0, 30]]; + // target_neck_thickness_additional_points = [[400.025-fret_width/2, 22], [380, 25], [130, 42], [0, 42]]; + target_neck_thickness_additional_points = [[400.025-fret_width/2, 22], [380, 25], [0, 25]]; + // target_neck_thickness_additional_points = [[400.025-fret_width/2, 22], [130, 42], [0, 42]]; echo(str("Making a Nylon 6 String with scale length ", fsl_mm, "mm = ", fsl_mm/25.4, "in and neck width ", neck_width, "mm")); assert(fsl_mm == Classical_Short_Scale_mm); // Make sure the function correctly uses our changed global @@ -365,6 +387,9 @@ module Nylon6String() { for (v = CF_Span_Coords(full_length, ply)) translate(v) CFSquare(hole=hole); } + module MyNeck() { + neck(num_frets=num_frets, num_strings=num_strings, string_margin=string_margin, string_spacing=string_spacing, scallop_depth=scallop_depth, target_neck_thickness=target_neck_thickness, target_neck_thickness_additional_points=target_neck_thickness_additional_points); + } reinforcing_tube_positions = flatten([ [ @@ -407,7 +432,7 @@ module Nylon6String() { } translate([0,to_origin ? -x0 : 0,0]) render() difference() { - neck(num_frets=num_frets, num_strings=num_strings, string_margin=string_margin, string_spacing=string_spacing, scallop_depth=scallop_depth, target_neck_thickness=target_neck_thickness); + MyNeck(); translate([-100, 0, -100]) cube([200, x0, 200]); translate([-100, x1, -100]) cube([200, xn-x1, 200]); for (v = reinforcing_tube_positions) CFTubeCutout2(v, x0, x1); @@ -434,12 +459,13 @@ module Nylon6String() { translate([0,0,-9]) rotate([-90,180,180]) linear_extrude(3, center=true) text("PETG1α", size=2.5, halign="center", valign="center"); } } - RealPiece(0, 8, include_from_fret=true); + // RealPiece(0, 8, include_from_fret=true); + RealPiece(8, 21); %translate([100, 0, 0]) RealPiece(8, 21); %translate([-100,0,0]) union() { c_cf = [0.4, 0.5, 0.5]; - %neck(num_frets=num_frets, num_strings=num_strings, string_margin=string_margin, string_spacing=string_spacing, scallop_depth=scallop_depth, target_neck_thickness=target_neck_thickness); + %MyNeck(); // CF square stacks for (v = reinforcing_tube_positions) color(c_cf) translate(v) CFTube(); for (v = reinforcing_square_positions) color(c_cf) translate(v) CFSquare();