Special Variables refactoring, Pt1
This commit is contained in:
parent
a736d81fec
commit
24e7ec255c
|
@ -21,12 +21,12 @@ Font = "GFS Didot";
|
|||
// Font = "Liberation Mono";
|
||||
// Font = "Noto Sans";
|
||||
|
||||
module cyl(d=10, z0=-100, z1=100, $fn=64)
|
||||
module cyl(d=10, z0=-100, z1=100)
|
||||
translate([0,0,z0])
|
||||
cylinder(h=z1-z0, r=d/2, $fn=$fn);
|
||||
module c(d=10, z=0, $fn=64) // 3d circle
|
||||
cylinder(h=z1-z0, r=d/2);
|
||||
module c(d=10, z=0) // 3d circle
|
||||
translate([0,0,z])
|
||||
cylinder(h=0.00001, r=d/2, $fn=$fn);
|
||||
cylinder(h=0.00001, r=d/2);
|
||||
|
||||
module tuner_tab_hole(shrink=0) {
|
||||
translate([0, -Tuner_Tab_Hole_Outset+Tuner_Tab_Hole_Dia/2])
|
||||
|
|
21
CFTubes.scad
21
CFTubes.scad
|
@ -59,14 +59,14 @@ module tailpiece(string_spacing=18, string_margin=4.5, num_strings=3, target_nec
|
|||
module tuner() {
|
||||
hole_r = 3;
|
||||
bend_r = 24 + hole_r + 10;
|
||||
fn=72;
|
||||
rotate([90, -90, 90]) UBassTuner(from_below=true, from_side=true);
|
||||
// translate([35,16,0]) cylinder(h=10-t_z, d=7, $fn=72);
|
||||
$fn=72;
|
||||
// translate([35,16,0]) cylinder(h=10-t_z, d=7);
|
||||
translate([36-7,7,1]) for (a = [10:89]) {
|
||||
hull() {
|
||||
translate([a/9, bend_r-bend_r*sin(a), bend_r*cos(a)]) sphere(hole_r, $fn=fn);
|
||||
translate([(a+1)/9, bend_r-bend_r*sin(a+1), bend_r*cos(a+1)]) sphere(hole_r, $fn=fn);
|
||||
translate([7, bend_r-bend_r*sin(a+1), bend_r*cos(a+1)]) sphere(hole_r, $fn=fn);
|
||||
translate([a/9, bend_r-bend_r*sin(a), bend_r*cos(a)]) sphere(hole_r);
|
||||
translate([(a+1)/9, bend_r-bend_r*sin(a+1), bend_r*cos(a+1)]) sphere(hole_r);
|
||||
translate([7, bend_r-bend_r*sin(a+1), bend_r*cos(a+1)]) sphere(hole_r);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -167,18 +167,19 @@ module headpiece(string_spacing=18, string_margin=4.5, num_strings=3, target_nec
|
|||
module string_tubes(tolerance = 1.0) {
|
||||
string_thicknesses = [4.9, 4.2, 3.0];
|
||||
module string_tube(diameter, fn=36) {
|
||||
$fn = fn;
|
||||
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);
|
||||
translate([0, bend_r*sin(a), bend_r*cos(a)]) sphere(hole_r);
|
||||
translate([0, bend_r*sin(a+1), bend_r*cos(a+1)]) sphere(hole_r);
|
||||
}
|
||||
}
|
||||
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);
|
||||
translate([0, bend_r*sin(90), bend_r*cos(90)]) sphere(hole_r);
|
||||
translate([0, bend_r*sin(90), -target_neck_thickness]) sphere(hole_r);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -1104,6 +1105,7 @@ COLOURSCHEME_PETGHF_BLUE = [BAMBU_PETGHF_LAKE_BLUE, BAMBU_PETGHF_LAKE_BLUE, "",
|
|||
// }
|
||||
|
||||
module TwoBangerMk2(include_colours=[0,1], segment=-1, preview=false) {
|
||||
$guitar_scale_length_mm = PBass_Scale_mm;
|
||||
id_line_0 = "ABS";
|
||||
id_line_1 = "2";
|
||||
fsl_mm = fret_scale_length(0);
|
||||
|
@ -1299,7 +1301,6 @@ module TwoBangerMk2(include_colours=[0,1], segment=-1, preview=false) {
|
|||
}
|
||||
}
|
||||
}
|
||||
Guitar_Scale_Length_mm = PBass_Scale_mm;
|
||||
|
||||
colour_scheme = COLOURSCHEME_ABS_BLUE;
|
||||
// TwoBangerMk2(preview=true);
|
||||
|
|
|
@ -27,25 +27,25 @@ module CFTubeCutout(x1, x2, tolerance = CF_Tube_OD_tolerance, VLH = false, taper
|
|||
taper_direction = (x1 > x2) ? (-1) : 1;
|
||||
x_min = min(x1, x2);
|
||||
x_max = max(x1, x2);
|
||||
fn = 360;
|
||||
$fn = 360;
|
||||
translate([0, x_min, 0])
|
||||
rotate([-90,0,0])
|
||||
cylinder(h=x_max-x_min, d=CF_Tube_OD+tolerance, $fn=fn);
|
||||
cylinder(h=x_max-x_min, d=CF_Tube_OD+tolerance);
|
||||
hull() {
|
||||
translate([0, x1])
|
||||
rotate([-90,0,0])
|
||||
cylinder(h=hull_epsilon, d=(CF_Tube_OD*taper_mul)+tolerance, $fn=fn);
|
||||
cylinder(h=hull_epsilon, d=(CF_Tube_OD*taper_mul)+tolerance);
|
||||
translate([0, x1+(taper_length*taper_direction)])
|
||||
rotate([-90,0,0])
|
||||
cylinder(h=hull_epsilon, d=CF_Tube_OD+tolerance, $fn=fn);
|
||||
cylinder(h=hull_epsilon, d=CF_Tube_OD+tolerance);
|
||||
}
|
||||
hull() {
|
||||
translate([0, x2])
|
||||
rotate([-90,0,0])
|
||||
cylinder(h=hull_epsilon, d=(CF_Tube_OD*taper_mul)+tolerance, $fn=fn);
|
||||
cylinder(h=hull_epsilon, d=(CF_Tube_OD*taper_mul)+tolerance);
|
||||
translate([0, x2-(taper_length*taper_direction)])
|
||||
rotate([-90,0,0])
|
||||
cylinder(h=hull_epsilon, d=CF_Tube_OD+tolerance, $fn=fn);
|
||||
cylinder(h=hull_epsilon, d=CF_Tube_OD+tolerance);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -82,10 +82,10 @@ module CFTubeCutout2(v, block_y0, block_y1, tolerance = CF_Tube_OD_tolerance, VL
|
|||
OD = CF_Tube_OD + tolerance;
|
||||
taper_OD = (CF_Tube_OD*taper_mul) + tolerance;
|
||||
|
||||
fn = 360;
|
||||
$fn = 360;
|
||||
// Full cylinder, unconditional
|
||||
translate(v) translate([0, -tolerance_length, 0]) hull() {
|
||||
rotate([-90,0,0]) cylinder(h=CF_Tube_Len+tolerance_length*2, d=OD, $fn=fn);
|
||||
rotate([-90,0,0]) cylinder(h=CF_Tube_Len+tolerance_length*2, d=OD);
|
||||
if (notch) translate([-OD*0.02, 0, -OD*0.6]) cube([OD*0.04, CF_Tube_Len, OD*0.6]);
|
||||
}
|
||||
|
||||
|
@ -93,16 +93,16 @@ module CFTubeCutout2(v, block_y0, block_y1, tolerance = CF_Tube_OD_tolerance, VL
|
|||
if ((block_y0 >= tube_y0) && (block_y0 < tube_y1)) // Tube protrudes through start of block
|
||||
hull() {
|
||||
translate([v[0], block_y0, v[2]])
|
||||
rotate([-90,0,0]) cylinder(h=hull_epsilon, d=taper_OD, $fn=fn);
|
||||
rotate([-90,0,0]) cylinder(h=hull_epsilon, d=taper_OD);
|
||||
translate([v[0], block_y0+taper_length, v[2]])
|
||||
rotate([-90,0,0]) cylinder(h=hull_epsilon, d=OD, $fn=fn);
|
||||
rotate([-90,0,0]) cylinder(h=hull_epsilon, d=OD);
|
||||
}
|
||||
if ((block_y1 <= tube_y1) && (block_y1 > tube_y0)) // Tube protrudes through end of block
|
||||
hull() {
|
||||
translate([v[0], block_y1-hull_epsilon, v[2]])
|
||||
rotate([-90,0,0]) cylinder(h=hull_epsilon, d=taper_OD, $fn=fn);
|
||||
rotate([-90,0,0]) cylinder(h=hull_epsilon, d=taper_OD);
|
||||
translate([v[0], block_y1-hull_epsilon-taper_length, v[2]])
|
||||
rotate([-90,0,0]) cylinder(h=hull_epsilon, d=OD, $fn=fn);
|
||||
rotate([-90,0,0]) cylinder(h=hull_epsilon, d=OD);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@ module neck(string_spacing=18, string_margin=4.5, num_strings=3, target_neck_thi
|
|||
scallops();
|
||||
scallop(num_frets+1);
|
||||
// Chop off anything above the frets
|
||||
translate([-neck_width, 0, scallop_depth]) cube([neck_width*2, Guitar_Scale_Length_mm*3, target_neck_thickness*3]);
|
||||
translate([-neck_width, 0, scallop_depth]) cube([neck_width*2, $guitar_scale_length_mm*3, target_neck_thickness*3]);
|
||||
// Reduce rest of the body to 0
|
||||
translate([-neck_width, 0, 0]) cube([neck_width*2, (fret_scale_length(num_frets)+fret_scale_length(num_frets+1))/2, target_neck_thickness*3]);
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ module neck(string_spacing=18, string_margin=4.5, num_strings=3, target_neck_thi
|
|||
difference() {
|
||||
neck_stock();
|
||||
scallop(25);
|
||||
translate([-neck_width, 0, scallop_depth]) cube([neck_width*2, Guitar_Scale_Length_mm*3, target_neck_thickness*3]);
|
||||
translate([-neck_width, 0, scallop_depth]) cube([neck_width*2, $guitar_scale_length_mm*3, target_neck_thickness*3]);
|
||||
translate([-neck_width, 0, 0]) cube([neck_width*2, (fret_scale_length(25)+fret_scale_length(24))/2, target_neck_thickness*3]);
|
||||
}
|
||||
} else {
|
||||
|
@ -282,7 +282,7 @@ module TaperNeck(
|
|||
scallops();
|
||||
scallop(num_frets+1);
|
||||
// Chop off anything above the frets
|
||||
translate([-neck_width_bridge, 0, z1]) cube([neck_width_bridge*2, Guitar_Scale_Length_mm*3, target_neck_thickness*3]);
|
||||
translate([-neck_width_bridge, 0, z1]) cube([neck_width_bridge*2, $guitar_scale_length_mm*3, target_neck_thickness*3]);
|
||||
// Reduce rest of the body to 0
|
||||
translate([-neck_width_bridge, 0, 0]) cube([neck_width_bridge*2, (fret_scale_length(num_frets)+fret_scale_length(num_frets+1))/2, target_neck_thickness*3]);
|
||||
}
|
||||
|
@ -296,7 +296,7 @@ module TaperNeck(
|
|||
difference() {
|
||||
neck_stock();
|
||||
scallop(25);
|
||||
translate([-neck_width_bridge, 0, scallop_depth]) cube([neck_width_bridge*2, Guitar_Scale_Length_mm*3, target_neck_thickness*3]);
|
||||
translate([-neck_width_bridge, 0, scallop_depth]) cube([neck_width_bridge*2, $guitar_scale_length_mm*3, target_neck_thickness*3]);
|
||||
translate([-neck_width_bridge, 0, 0]) cube([neck_width_bridge*2, (fret_scale_length(25)+fret_scale_length(24))/2, target_neck_thickness*3]);
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -33,7 +33,7 @@ module LockingGuitarTuner(holes=0) {
|
|||
}
|
||||
module Holes() {
|
||||
cylinder_beak(d=d_post_cutout, h=h_post_cutout);
|
||||
rotate([0, 0, 45]) translate([0, 10.5]) linear_extrude(screw_depth) screw_hole_lobe(screw_diameter, screw_diameter+1, 5);
|
||||
rotate([0, 0, 45]) translate([0, 10.5]) linear_extrude(screw_depth) screw_hole_lobe(screw_diameter, screw_diameter+1, 5, $fn=90);
|
||||
}
|
||||
|
||||
module TunerPreview() {
|
||||
|
|
18
common.scad
18
common.scad
|
@ -4,11 +4,11 @@ Classical_Normal_Scale_mm = 650; // about 25.59inch
|
|||
Classical_Short_Scale_mm = 635; // = 25inch
|
||||
Gibson_Scale_mm = 630; // 24.75inch = 628.65mm
|
||||
|
||||
Guitar_Scale_Length_mm = Fender_Scale_mm;
|
||||
$guitar_scale_length_mm = Fender_Scale_mm;
|
||||
ln2 = ln(2);
|
||||
function log2(x) = ln(x)/ln2;
|
||||
function fret_scale_length(n) = Guitar_Scale_Length_mm * 2^(-n/12);
|
||||
function mm_to_fret_number(mm) = -log2(mm/Guitar_Scale_Length_mm)*12;
|
||||
function fret_scale_length(n) = $guitar_scale_length_mm * 2^(-n/12);
|
||||
function mm_to_fret_number(mm) = -log2(mm/$guitar_scale_length_mm)*12;
|
||||
function lerp(start, end, amount) = start + (end-start)*amount;
|
||||
function clamp(minimum, value, maximum) = min(max(minimum, value), maximum);
|
||||
|
||||
|
@ -74,19 +74,19 @@ module rotate_around(angles, pt) {
|
|||
children();
|
||||
}
|
||||
|
||||
module screw_hole_lobe(ID, OD, lobes=3, fn=90) {
|
||||
module screw_hole_lobe(ID, OD, lobes=3) {
|
||||
difference() {
|
||||
circle(d=OD, $fn=fn);
|
||||
circle(d=OD);
|
||||
for (a=[0:360/lobes:360])
|
||||
translate((OD/2)*[cos(a), sin(a)])
|
||||
circle(d=OD-ID, $fn=fn);
|
||||
circle(d=OD-ID);
|
||||
}
|
||||
}
|
||||
|
||||
module cylinder_outer(d, h, fn) {
|
||||
module cylinder_outer(d, h) {
|
||||
// Regular circle inscribes, this circumscribes
|
||||
fudge = 1/cos(180/fn);
|
||||
cylinder(d=d*fudge, h=h, $fn=fn);
|
||||
fudge = 1/cos(180/$fn);
|
||||
cylinder(d=d*fudge, h=h);
|
||||
}
|
||||
|
||||
module cylinder_beak(d, h, beak=0.75) {
|
||||
|
|
Loading…
Reference in New Issue