Browse Source

redo all the geometry for the triangular top connecting legs, make sure it works for tetrahedral microphone and octathingy, add code to enable leg rendering only when it is physically possible to create the connection (avoid capsule holders that touch each other, and for higher capsule angle avoid leg fingers that touch the adyacent capsule), for triangular connecting legs use the lef_thick parameter to define the height of the legs - otherwise for eight or more capsule designs the slant of the leg limits the minimum radius of the array

Fernando Pablo Lopez-Lezcano 9 years ago
parent
commit
f8d798b54b
1 changed files with 34 additions and 22 deletions
  1. 34 22
      SpHEAR_common.scad

+ 34 - 22
SpHEAR_common.scad

@@ -112,7 +112,8 @@ fudge = 0.12;
 // adjustment for fit of slots in connection legs and mount
 // 0.1: initial setting
 // 0.1 ->0.15: Ultimaker 2 + Extended plus APL (2016.06.17)
-fit = 0.15;
+// 0.15->0.10 (2017.01.21)
+fit = 0.10;
 
 // number of facets for rendering cylinders
 facets = 64;
@@ -140,8 +141,17 @@ module capsule (mounts, twist, ridge, ridge_wfit = 0.0, ridge_hfit = 0.0, solid
             // the mounting legs
             for (angles = mounts) {
                 rotate([0, 0, angles[0] + twist]) {
+                    // disable rendering of the connection legs if the array radius is too
+                    // small and components of adyacent capsule holders touch each other
+                    //
+                    leg_height = leg_thick;
+                    // make sure capsule holders do not touch
+                    render_legs = ((mic_radius - capsule_height) / tan(angles[1])) - capsule_radius - wall -
+                        // and make sure connection leg does not touch adyacent capsule holder
+                        (angles[1] > 45 ? leg_height * tan(2 * angles[1] - 90) + 2 * fit : 0.0);
+                    //
                     // connect with cylindrical beams, very pretty, not printable
-                    if (connect == 0) {
+                    if (connect == 0 && render_legs >= 0) {
                         leg_length = mic_radius * cos(angles[1]) - capsule_radius * sin(angles[1]);
                         translate([capsule_radius - wall, 0, capsule_height - wall]) {
                             rotate([0, 180 - angles[1], 0]) {
@@ -149,36 +159,38 @@ module capsule (mounts, twist, ridge, ridge_wfit = 0.0, ridge_hfit = 0.0, solid
                             }
                         }
                     }
-                    // connect with horizontal slanted legs (only works for small microphone radius)
-                    if (connect == 1) {
-                        leg_length = (mic_radius - capsule_height + leg_thick + fit) * tan(90 - angles[1]);
-                        slot_depth = leg_thick / cos(90 - 2 * angles[1]);
-                        slot_xtra_depth = (angles[1] < 45) ? (leg_thick * tan(90 - 2 * angles[1])) : 0.0;
+                    // connect with horizontal legs with triangular top (the best by far)
+                    if (connect == 1 && render_legs >= 0) {
+                        leg_length = capsule_radius + wall + capsule_height * tan(angles[1]) - fit;
+                        slot_radius = (mic_radius - capsule_height) / tan(angles[1]);
                         translate([0, 2 * (- leg_width / 3), 0]) {
                             difference() {
                                 cube([leg_length, leg_width + leg_width / 3, capsule_height]);
-                                // cut center slot in connector
-                                translate([leg_length - slot_depth - slot_xtra_depth - 2 * fit, leg_width / 3 - (fit / 2), 0]) {
-                                    rotate([0, elev_angle / 2, 0])
-                                    cube([slot_depth + slot_xtra_depth + fit, leg_width / 3 + fit, capsule_height]);
-                                }
-                                // cut side slot
-                                translate([leg_length - slot_depth - slot_xtra_depth - 2 * fit, leg_width - fit / 2, 0]) {
-                                    // FIXME: we need to do the geometry for the angle below as I had to tweak it...
-                                    rotate([0, elev_angle / 2 + 1.5, 0])
-                                    cube([slot_depth + slot_xtra_depth + fit, leg_width / 3 + fit, capsule_height]);
+                                // cut slots that lock with adyacent leg
+                                for (offset = [1, 3]) {
+                                    translate([slot_radius - 1 * fit, leg_width / offset - fit / 2, 0]) {
+                                        rotate([0, 90 - angles[1] * 2, 0]) translate([0, 0, - capsule_height])
+                                        cube([leg_length, leg_width / 3 + fit, capsule_height * 2]);
+                                    }
                                 }
-                                // shave top of fingers
-                                translate([capsule_radius + wall, 0, capsule_height]) {
-                                    rotate([0, 90 - elev_angle, 0]) {
+                                // shave triangular slice of fingers, starts at edge of capsule holder
+                                translate([capsule_radius + wall, 0, leg_height]) {
+                                    rotate([0, 90 - angles[1], 0]) {
                                         cube([leg_length, leg_width + leg_width / 3, capsule_height]);
                                     }
                                 }
+                                // and remove the rest when the leg height is less than the capsule height
+                                translate([0, - 2 * (- leg_width / 3), leg_height]) {
+                                    difference() {
+                                        cylinder(r = capsule_radius + leg_length, h = capsule_height, $fn = facets);
+                                        cylinder(r = capsule_radius + wall, h = capsule_height, $fn = facets);
+                                    }
+                                }
                             }
                         }
                     }
                     // connect with horizontal legs
-                    if (connect == 2) {
+                    if (connect == 2 && render_legs >= 0) {
                         leg_length = (mic_radius - capsule_height + leg_thick) * tan(90 - angles[1]);
                         slot_depth = leg_thick / cos(90 - 2 * angles[1]);
                         slot_xtra_depth = (angles[1] < 45) ? (leg_thick * tan(90 - 2 * angles[1])) : 0.0;
@@ -193,7 +205,7 @@ module capsule (mounts, twist, ridge, ridge_wfit = 0.0, ridge_hfit = 0.0, solid
                         }
                     }
                     // connect with vertical legs
-                    if (connect == 3) {
+                    if (connect == 3 && render_legs >= 0) {
                         // fix this 0.2 == (2 * fudge?)
                         leg_length = (mic_radius * tan(90 - angles[1]) - capsule_radius) * tan(angles[1]) - 0.2;
                         slot_depth = leg_thick * cos (90 - (2 * angles[1]));