Major cleanup and refactor

This commit is contained in:
Quinn
2021-12-29 20:10:54 -08:00
parent 3ae80470bd
commit 1948c924a1
2 changed files with 147 additions and 139 deletions
+129 -121
View File
@@ -1,31 +1,97 @@
$fn = 100; $fn = 360;
collar_r = 34.7/2; collar_r = 34.7/2;
collar_h = 8.7; // short collar: 8.7, full: 18 collar_h = 8.7; // short collar: 8.7, full: 18
collar_inner_corner_r = 9/2; //should roughly match shaft for best feel shaft_r = 9/2; //should roughly match shaft for best feel
collar_inner_r = 13.2/2; //inner radius at bottom of official collar is 13.2 //inner radius at bottom of official collar is 13.2
max_throw_circle = 10; cardinal_throw = 10;
max_throw_square = 14; max_throw_square = 14;
grommet_dist = 6.8; //distance the grommet sits below this component grommet_dist = 6.8; //distance the grommet sits below this component
grommet_depth = 6.4; //thickness of grommet (when compressed) grommet_depth = 6.4; //thickness of grommet (when compressed)
pivot_depth = grommet_dist + grommet_depth / 2; pivot_depth = grommet_dist + grommet_depth / 2;
VERSION = "V1A";
module rotate_about_pt(rotation, pt) { CIR = "CIR";
translate(pt) SQR = "SQR";
rotate(rotation) OCT = "OCT";
translate(-pt) OCTR = "OCTR";
children(); OCTN = "OCTN";
OCTNR = "OCTNR";
rotate([0,0,0]){
/*
* OCTNR corner test (seems to also match OCTN, nice!)
* shaft(shaft_r, pivot_depth, [cardinal_throw+1.95,0,45]);
*/
juqs(model = OCTNR, ver = VERSION);
} }
module collar (full = false, bezel = 1) { module juqs(model, ver) {
h = 8.7; rotate([0,0,0]) {
r = 34.7/2; difference() {
if(full) { difference() {
h = 18; union() {
base();
collar(collar_h);
};
if(model == CIR)
cir_hollow(cardinal_throw, shaft_r, pivot_depth);
if(model == SQR)
sqr_hollow(max_throw_square, shaft_r, pivot_depth);
if(model == OCT)
oct_hollow(cardinal_throw, shaft_r, pivot_depth);
if(model == OCTR)
octr_hollow(cardinal_throw, shaft_r, pivot_depth);
if(model == OCTN)
octn_hollow(cardinal_throw, shaft_r, pivot_depth);
if(model == OCTNR)
octnr_hollow(cardinal_throw, shaft_r, pivot_depth);
};
translate([0, -11, -0.1]) {
modtext = str("JUQS-",model);
font = "Open Sans:style=Bold";
fontsize = 3.75;
mirror([1,0,0]) {
linear_extrude(0.7){
text(modtext, font=font, size=fontsize, halign = "center");
translate([0, -5, 0])
text(ver, font=font, size=fontsize, halign = "center");
} }
};
};
};
};
};
module shaft(r, depth, rotation) {
translate([0,0,-pivot_depth]){
rotate(rotation)
cylinder(h = 100, r = shaft_r);
}
};
module base (size = [37.16, 37.1, 2.8], r = 8) {
w = size.x;
l = size.y;
h = size.z;
corner_offset = [w/2 - r, l/2 - r];
hull() {
translate([corner_offset.x, corner_offset.y, 0])
cylinder(h=h, r=r);
translate([-corner_offset.x, corner_offset.y, 0])
cylinder(h=h, r=r);
translate([corner_offset.x, -corner_offset.y, 0])
cylinder(h=h, r=r);
translate([-corner_offset.x, -corner_offset.y, 0])
cylinder(h=h, r=r);
};
};
// use h=18 for full collar
module collar (h = 8.7, r = (34.7/2), bezel = 1) {
union() { union() {
cylinder(h=h - bezel, r=r); cylinder(h=h - bezel, r=r);
translate([0,0,h - bezel]) { translate([0,0,h - bezel]) {
@@ -34,28 +100,7 @@ module collar (full = false, bezel = 1) {
} }
} }
module base (size = [37.16, 37.1, 2.8], r = 8) { module ci_pivot (throw, shaft_r) {
w = size.x;
l = size.y;
h = size.z;
corner_offset = [w/2 - r, l/2 - r];
hull() {
translate([corner_offset.x, corner_offset.y, 0]) {
cylinder(h=h, r=r);
};
translate([-corner_offset.x, corner_offset.y, 0]) {
cylinder(h=h, r=r);
};
translate([corner_offset.x, -corner_offset.y, 0]) {
cylinder(h=h, r=r);
};
translate([-corner_offset.x, -corner_offset.y, 0]) {
cylinder(h=h, r=r);
};
};
};
module ci_pivot (throw, shaft_r, depth) {
h = 50; h = 50;
top_r = h * tan(throw) + shaft_r; top_r = h * tan(throw) + shaft_r;
cylinder(h = h, r1 = shaft_r, r2 = top_r); cylinder(h = h, r1 = shaft_r, r2 = top_r);
@@ -63,111 +108,74 @@ module ci_pivot (throw, shaft_r, depth) {
module sq_pivot (throw, shaft_r, depth, sharpness = 1, throw_extend = 0) { module sq_pivot (throw, shaft_r, depth, sharpness = 1, throw_extend = 0) {
h = 50; h = 50;
corner_r = shaft_r / sharpness; shaft_r = shaft_r / sharpness;
corner_offset = corner_r * (sharpness - 1); corner_offset = shaft_r * (sharpness - 1);
translate([0,0,-depth]) { translate([0,0,-depth]) {
hull() { hull() {
translate([corner_offset,0,0]){ translate([corner_offset,0,0])
rotate([0,throw,0]){ rotate([0,throw,0])
ci_pivot(throw = throw_extend, shaft_r = corner_r, depth = depth); ci_pivot(throw = throw_extend, shaft_r = shaft_r);
} translate([-corner_offset,0,0])
} rotate([0,-throw,0])
translate([-corner_offset,0,0]){ ci_pivot(throw = throw_extend, shaft_r = shaft_r);
rotate([0,-throw,0]){ rotate([0,0,90]) {
ci_pivot(throw = throw_extend, shaft_r = corner_r, depth = depth); translate([corner_offset,0,0])
} rotate([0,throw,0])
} ci_pivot(throw = throw_extend, shaft_r = shaft_r);
rotate([0,0,90]){ translate([-corner_offset,0,0])
translate([corner_offset,0,0]){ rotate([0,-throw,0])
rotate([0,throw,0]){ ci_pivot(throw = throw_extend, shaft_r = shaft_r);
ci_pivot(throw = throw_extend, shaft_r = corner_r, depth = depth);
}
}
translate([-corner_offset,0,0]){
rotate([0,-throw,0]){
ci_pivot(throw = throw_extend, shaft_r = corner_r, depth = depth);
}
}
} }
}; };
} }
} }
module sq_hollow (corner_r, slope) { module cir_hollow(slope, shaft_r, depth) {
rotate([0,0,45]) { translate([0,0,-depth])
sq_pivot(slope, corner_r, pivot_depth); ci_pivot(slope, shaft_r);
}
module sqr_hollow (slope, shaft_r, depth) {
rotate([0,0,45])
sq_pivot(slope, shaft_r, depth);
};
module oct_hollow (slope, shaft_r, depth) {
hull() {
rotate([0,0,45])
sq_pivot(slope, shaft_r, depth);
sq_pivot(slope, shaft_r, depth);
} }
}; };
module oct_hollow (corner_r, slope) { module octn_hollow (slope, shaft_r, depth) {
hull(){ hull(){
rotate([0,0,45]) { rotate([0,0,45])
sq_pivot(slope, corner_r, pivot_depth); sq_pivot(slope + 3, shaft_r, depth, 3);
} sq_pivot(slope, shaft_r, depth, 3);
sq_pivot(slope, corner_r, pivot_depth);
} }
}; };
module soct_hollow (corner_r, slope) { module octr_hollow (slope, shaft_r, depth) {
hull(){
rotate([0,0,45]) {
sq_pivot(slope + 2, corner_r, pivot_depth, 4);
}
sq_pivot(slope, corner_r, pivot_depth, 4);
}
};
module roct_hollow (corner_r, slope) {
union(){ union(){
rotate([0,0,45]) { rotate([0,0,45])
sq_pivot(slope, corner_r, pivot_depth); sq_pivot(slope, shaft_r, depth);
} sq_pivot(slope, shaft_r, depth);
sq_pivot(slope, corner_r, pivot_depth);
} }
}; };
module nroct_hollow (corner_r, slope) { module octnr_hollow (slope, shaft_r, depth) {
//diag_r = corner_r * 1.075;
union(){ union(){
rotate([0,0,45]) { rotate([0,0,45])
sq_pivot(slope + 1, corner_r, pivot_depth, 1, 1); sq_pivot(slope + 1, shaft_r, depth, 1, 1);
} sq_pivot(slope, shaft_r, depth);
sq_pivot(slope, corner_r, pivot_depth);
} }
}; };
translate([0,0,-pivot_depth]){ module rotate_about_pt(rotation, pt) {
rotate([0,0,0]){ translate(pt)
cylinder(h = 100, r = collar_inner_corner_r); rotate(rotation)
} translate(-pt)
} children();
};
rotate([0,0,0]) {
difference() {
difference() {
union() {
base();
collar(false);
};
//sq_hollow(collar_inner_corner_r, max_throw_square);
//oct_hollow(collar_inner_corner_r, max_throw_circle);
//soct_hollow(collar_inner_corner_r, max_throw_circle);
//roct_hollow(collar_inner_corner_r, max_throw_circle);
nroct_hollow(collar_inner_corner_r, max_throw_circle);
//ci_pivot(max_throw_circle, collar_inner_corner_r, pivot_depth);
};
};
/*
translate([0, -13, -0.1]) {
font = "Open Sans:style=Bold";
mirror([1,0,0]) {
linear_extrude(0.6)
//text("QJ-SQR-V2", font=font, size=3.5, halign = "center");h = 8.7;
//text("QJ-OCT-V2", font=font, size=3.5, halign = "center");
//text("QJ-OCS-V2", font=font, size=3.5, halign = "center");
//text("QJ-OCR-V2", font=font, size=3.5, halign = "center");
text("QJ-OCR-V2", font=font, size=3.5, halign = "center");
}
}
*/
};
Binary file not shown.