From fb074a457cc41064b0707a9b6f6f32fa14c064e4 Mon Sep 17 00:00:00 2001 From: Luke Hubmayer-Werner Date: Tue, 24 Dec 2024 20:44:43 +1030 Subject: [PATCH] Refactor UBassTuner to its own file --- CFTubes.scad | 91 ++----------------------------------------------- UBassTuner.scad | 86 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 88 insertions(+), 89 deletions(-) create mode 100644 UBassTuner.scad diff --git a/CFTubes.scad b/CFTubes.scad index 04aa50b..11cf68d 100644 --- a/CFTubes.scad +++ b/CFTubes.scad @@ -201,94 +201,6 @@ module headpiece(string_spacing=18, string_margin=4.5, num_strings=3, target_nec } } -module ubass_tuner() { - t_base = 11; - d_thread = 11.0 + 0.25; - d_collar = 13.8 + 0.2; // Add some tolerance - l_collar = 8; // doesn't include hex - l_collarnut_to_top_of_peg = 22; - d_top_of_peg = 16; - max_thread = 5.0; // thread to cover without the collar - w_tag = 19; - l_tag = 32.5; - l_tag_rect = 20.1; - back_of_peg_collar_to_end = 10.8; - d_screw = 2.0; // As we will screw into this, probably don't need tolerance yet - screw_tab_min_w = 1.6; - screw_tab_min_thick = 2.0; - d_screw_tab = 5.2+0.9; // Tolerance this though! - // back_of_thread_to_tab_tip = 20.7 + 0.1; // 17.1 measuring far hole end to hole end, 6.9 measuring close ends gives average of 12.0 - middle_of_thread_to_tab_screw = 12.1; //back_of_thread_to_tab_tip - d_thread/2 - screw_tab_min_w; == 13.7 - echo(middle_of_thread_to_tab_screw); - l_wormshaft_ear = 36; - d_wormshaft_ear = 33.4+0.6; - l_wormshaft_collar = 12; - d_wormshaft_collar = 7.2; - d_wormshaft_collar_max = 9.4; - middle_of_tab_screw_to_wormshaft = (-l_tag+d_screw_tab/2+back_of_peg_collar_to_end-d_wormshaft_collar_max/2) /* -23.35 */ + 0.15; - echo(middle_of_tab_screw_to_wormshaft); - - module tuner_footprint() { - hull() { - translate([-w_tag/2, -l_tag+d_screw_tab/2]) square([w_tag, l_tag_rect]); - circle(d=d_screw_tab, $fn=72); - } - } - module tuner_footprint_extrude(h) { - // linear_extrude on tuner_footprint() segfaults for no reason - // src/openscad/src/geometry/linear_extrude.cc:409: std::unique_ptr extrudePolygon(const LinearExtrudeNode&, const Polygon2d&): Assertion `poly.isSanitized()' failed. - hull() { - translate([-w_tag/2, -l_tag+d_screw_tab/2, 0]) cube([w_tag, l_tag_rect, h]); - cylinder(h=h, d=d_screw_tab, $fn=72); - } - } - module holes() { - circle(d=d_screw, $fn=72); - translate([0, -middle_of_thread_to_tab_screw]) circle(d=d_thread, $fn=72); - } - - module tuner_clearance(clearance=11) { - clear_color = [1,0,0,0.6]; - // 21mm is roughly the height of the disassembled tuner from body to top of thread, 22mm should be safe - // translate([0,0,-clearance]) tuner_footprint_extrude(t_base+clearance); - color("grey") tuner_footprint_extrude(t_base); - color(clear_color) translate([0,0,-clearance]) tuner_footprint_extrude(clearance); - // screw - color(clear_color) - translate([0,0,t_base]) cylinder(h=6, d=d_screw, $fn=72); - // peg - translate([0, -middle_of_thread_to_tab_screw, t_base]) cylinder(h=max_thread, d=d_thread, $fn=72); - translate([0, -middle_of_thread_to_tab_screw, t_base+max_thread]) cylinder(h=l_collar, d=d_collar, $fn=72); - translate([0, -middle_of_thread_to_tab_screw, t_base+max_thread+l_collar]) cylinder(h=l_collarnut_to_top_of_peg, d=d_top_of_peg, $fn=72); - // wormshaft and ear - translate([w_tag/2, middle_of_tab_screw_to_wormshaft, t_base/2]) { - hull() { - rotate([0, 90, 0]) cylinder(h=0.1, d=d_wormshaft_collar_max, $fn=72); - translate([2.3, 0, 0]) rotate([0, 90, 0]) cylinder(h=0.1, d=d_wormshaft_collar, $fn=72); - } - rotate([0, 90, 0]) cylinder(h=l_wormshaft_collar, d=d_wormshaft_collar, $fn=72); - // shaft clearance - shaft_clear = t_base/2 + clearance; - color(clear_color) union() { - hull() { - translate([0, -d_wormshaft_collar_max/2, -shaft_clear]) cube([0.1, d_wormshaft_collar_max, shaft_clear]); - translate([2.3, -d_wormshaft_collar/2, -shaft_clear]) cube([0.1, d_wormshaft_collar, shaft_clear]); - } - translate([0, -d_wormshaft_collar/2, -shaft_clear]) cube([l_wormshaft_ear, d_wormshaft_collar, shaft_clear]); - } - // ear clearance - color(clear_color) hull() { - translate([l_wormshaft_collar, 0, 0]) rotate([0, 90, 0]) cylinder(h=0.1, d=d_wormshaft_collar, $fn=72); - translate([l_wormshaft_ear, 0, 0]) rotate([0, 90, 0]) cylinder(h=0.1, d=d_wormshaft_ear, $fn=72); - } - } - } - difference() { - linear_extrude(17) offset(4, 3, $fn=72) tuner_footprint(); - mirror([1, 0, 0]) tuner_clearance(); - } -} - 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); @@ -296,4 +208,5 @@ echo(fret_scale_length(8) - fret_scale_length(24)); // 240.335 // fret_tube(8, 24); // headpiece(); -ubass_tuner(); +include +UBassTuner(); diff --git a/UBassTuner.scad b/UBassTuner.scad new file mode 100644 index 0000000..16ba9ef --- /dev/null +++ b/UBassTuner.scad @@ -0,0 +1,86 @@ + +module UBassTuner() { + t_base = 11; + d_thread = 11.0 + 0.25; + d_collar = 13.8 + 0.2; // Add some tolerance + l_collar = 8; // doesn't include hex + l_collarnut_to_top_of_peg = 22; + d_top_of_peg = 16; + max_thread = 5.0; // thread to cover without the collar + w_tag = 19; + l_tag = 32.5; + l_tag_rect = 20.1; + back_of_peg_collar_to_end = 10.8; + d_screw = 2.0; // As we will screw into this, probably don't need tolerance yet + screw_tab_min_w = 1.6; + screw_tab_min_thick = 2.0; + d_screw_tab = 5.2+0.9; // Tolerance this though! + // back_of_thread_to_tab_tip = 20.7 + 0.1; // 17.1 measuring far hole end to hole end, 6.9 measuring close ends gives average of 12.0 + middle_of_thread_to_tab_screw = 12.1; //back_of_thread_to_tab_tip - d_thread/2 - screw_tab_min_w; == 13.7 + echo(middle_of_thread_to_tab_screw); + l_wormshaft_ear = 36; + d_wormshaft_ear = 33.4+0.6; + l_wormshaft_collar = 12; + d_wormshaft_collar = 7.2; + d_wormshaft_collar_max = 9.4; + middle_of_tab_screw_to_wormshaft = (-l_tag+d_screw_tab/2+back_of_peg_collar_to_end-d_wormshaft_collar_max/2) /* -23.35 */ + 0.15; + echo(middle_of_tab_screw_to_wormshaft); + + module tuner_footprint() { + hull() { + translate([-w_tag/2, -l_tag+d_screw_tab/2]) square([w_tag, l_tag_rect]); + circle(d=d_screw_tab, $fn=72); + } + } + module tuner_footprint_extrude(h) { + // linear_extrude on tuner_footprint() segfaults for no reason + // src/openscad/src/geometry/linear_extrude.cc:409: std::unique_ptr extrudePolygon(const LinearExtrudeNode&, const Polygon2d&): Assertion `poly.isSanitized()' failed. + hull() { + translate([-w_tag/2, -l_tag+d_screw_tab/2, 0]) cube([w_tag, l_tag_rect, h]); + cylinder(h=h, d=d_screw_tab, $fn=72); + } + } + module holes() { + circle(d=d_screw, $fn=72); + translate([0, -middle_of_thread_to_tab_screw]) circle(d=d_thread, $fn=72); + } + + module tuner_clearance(clearance=11) { + clear_color = [1,0,0,0.6]; + // 21mm is roughly the height of the disassembled tuner from body to top of thread, 22mm should be safe + // translate([0,0,-clearance]) tuner_footprint_extrude(t_base+clearance); + color("grey") tuner_footprint_extrude(t_base); + color(clear_color) translate([0,0,-clearance]) tuner_footprint_extrude(clearance); + // screw + color(clear_color) + translate([0,0,t_base]) cylinder(h=6, d=d_screw, $fn=72); + // peg + translate([0, -middle_of_thread_to_tab_screw, t_base]) cylinder(h=max_thread, d=d_thread, $fn=72); + translate([0, -middle_of_thread_to_tab_screw, t_base+max_thread]) cylinder(h=l_collar, d=d_collar, $fn=72); + translate([0, -middle_of_thread_to_tab_screw, t_base+max_thread+l_collar]) cylinder(h=l_collarnut_to_top_of_peg, d=d_top_of_peg, $fn=72); + // wormshaft and ear + translate([w_tag/2, middle_of_tab_screw_to_wormshaft, t_base/2]) { + hull() { + rotate([0, 90, 0]) cylinder(h=0.1, d=d_wormshaft_collar_max, $fn=72); + translate([2.3, 0, 0]) rotate([0, 90, 0]) cylinder(h=0.1, d=d_wormshaft_collar, $fn=72); + } + rotate([0, 90, 0]) cylinder(h=l_wormshaft_collar, d=d_wormshaft_collar, $fn=72); + // shaft clearance + shaft_clear = t_base/2 + clearance; + color(clear_color) union() { + hull() { + translate([0, -d_wormshaft_collar_max/2, -shaft_clear]) cube([0.1, d_wormshaft_collar_max, shaft_clear]); + translate([2.3, -d_wormshaft_collar/2, -shaft_clear]) cube([0.1, d_wormshaft_collar, shaft_clear]); + } + translate([0, -d_wormshaft_collar/2, -shaft_clear]) cube([l_wormshaft_ear, d_wormshaft_collar, shaft_clear]); + } + // ear clearance + color(clear_color) hull() { + translate([l_wormshaft_collar, 0, 0]) rotate([0, 90, 0]) cylinder(h=0.1, d=d_wormshaft_collar, $fn=72); + translate([l_wormshaft_ear, 0, 0]) rotate([0, 90, 0]) cylinder(h=0.1, d=d_wormshaft_ear, $fn=72); + } + } + } + + tuner_clearance(); +}