fixing squared_spherical dish to work with all sizes

This commit is contained in:
mebers200 2021-07-09 10:22:03 -06:00
parent 13520c54e3
commit d3c26dfaca
1 changed files with 11 additions and 3 deletions

View File

@ -1,13 +1,21 @@
module squared_spherical_dish(width, height, depth, inverted=false) { module squared_spherical_dish(width, height, depth, inverted=false) {
chord = pow(pow(height / 2, 2) + pow(width / 2, 2),0.5); chord = pow(pow(height / 2, 2) + pow(width / 2, 2),0.5);
direction = inverted ? -1 : 1; direction = inverted ? -1 : 1;
r=width / 3.5; r=max(height,width,chord) / 5;
// ^^^^^ Nothing special about this code to figure out r.
// I just modeled up 1u, 1.25u, 1.5u, 2u, 2.25u, and 2.75u
// keys and messed around until I came up with something that
// looked reasonable for all key sizes. This just seems to work
// well for all sizes
translate([-width / 2, -height / 2, 0 * direction]) { translate([-width / 2, -height / 2, 0 * direction]) {
resize([width, height, depth]) resize([width, height, depth])
hull() { hull() {
cube([width,height,0.001]); cube([chord,chord,0.001]);
translate([width/2, height/2, -chord]) // Use something larger in this translate than -depth
// (like -chord) if you want more of a defined circle
// in the keywell
translate([chord/2, chord/2, -depth])
sphere(r=r, $fn=64); sphere(r=r, $fn=64);
} }
} }