Forráskód Böngészése

start merging the Octathingy code into the current code base, move the capsule holder and some parameters into a separate file (SpHEAR_common), finally fix the code that calculates the depth of the slot that creates the interlocking fingers that hold the array together - turns out there are two cases delimited by the angle between adyacent capsules, the code now works for both the TinySpHEAR and the Octathingy arrays

Fernando Pablo Lopez-Lezcano 10 éve
szülő
commit
98c5b937ae
2 módosított fájl, 228 hozzáadás és 110 törlés
  1. 228 0
      SpHEAR_common.scad
  2. 0 110
      TinySpHEAR_common.scad

+ 228 - 0
SpHEAR_common.scad

@@ -0,0 +1,228 @@
+//
+// Spherical Harmonics Ear Project (*SpHEAR)
+//
+// Common Modules and Variables
+//
+// Copyright 2015-2016, Fernando Lopez-Lezcano, All Rights Reserved
+// nando@ccrma.stanford.edu
+//
+//  This program is free software: you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation, either version 3 of the License, or
+//  (at your option) any later version.
+//
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+//
+//  You should have received a copy of the GNU General Public License
+//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// 3d Models released under the Creative Commons license as follows:
+//   Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)
+// http://creativecommons.org/licenses/by-nc-sa/4.0/
+
+////
+//// default model parameters
+////
+
+// microphone capsule array
+//
+// dimensions of the electret microphone capsule
+capsule_radius = 5;
+capsule_height = 4.5;
+
+// distance between the face of a capsule and the center of array
+mic_radius = 9.6;
+
+// dimensions of the capsule holder connection legs
+// a width of 4mm is too thin, 5mm prints better
+leg_width = 5;
+leg_thick = 1.75;
+
+// wall thickness of the capsule holder
+wall = 1;
+
+// width of the ridge that connects to the mount
+ridge_width = 2.0;
+ridge_slot_width = 2.0;
+// depth of the connector mount ridge
+ridge_depth = 3.0;
+// add to the thickness of ridges
+ridge_wfit = 0.1;
+ridge_hfit = 3;
+
+// microphone mount
+//
+mount_radius = 3.5;
+mount_wall = 0.75;
+
+// height and eccentricity of top connector
+mount_top_height = 10.0;
+mount_top_eccentricity = 1.3;
+
+// height of mount
+mount_height = 40;
+
+// microphone stand mount
+//
+// diameter of existing shielded wires (x 4)
+mic_wire_diam = 1.5;
+mic_wire_hole_radius = 3.0;
+mic_wire_hole_offset = 5;
+
+// standard microphone stand
+// measured diameter = 13.5, inside diameter of sleeve = 13.79 (
+mic_mount_radius = 13.50 / 2;
+// add this to inside diameter
+mic_mount_fit = 0.2;
+mic_mount_slot_height = 11.5;
+mic_mount_slot_width = 4.25;
+mic_mount_slot_radius = 6.25  / 2;
+mic_mount_wall = 1.5;
+mic_mount_height = 35.0 + mic_wire_hole_offset + mic_wire_hole_radius + 2 * mic_mount_wall;
+
+//// end of model parameters
+////
+//// rendering control
+
+// what type of connection to use between capsule holders:
+// 0 -> original cylindrical angled legs
+// 1 -> interlocking horizontal legs
+// 2 -> interlocking vertical legs
+connect = 1;
+
+// how many mount ridges to create
+// 0 -> no ridges
+// 1 -> 1 ridge
+// 2 -> 2 ridges
+ridges = 1;
+
+//// end of rendering control
+////
+
+// adjustment for the inner radius of the capsule holder
+//   measured inside diameter of a trial print was around 7.5 to 8.2 
+//   instead of 10, capsule diameter was 9.99)
+// 0.1 -> 0.08: Ultimaker 2 + Extended plus APL (2016.06.17)
+fudge = 0.08;
+
+// 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;
+
+// number of facets for rendering cylinders
+facets = 64;
+// render capsule holders with better resolution
+cfacets = 128;
+
+////////
+// microphone capsule holder
+
+// mounts: vectors containing the angle of the mount and the angle to the adjacent capsule
+// twist: rotate the whole capsule to match mounting legs
+// ridge: add 0, 1 or 2 ridges for attaching the structure to the mount
+// ridge_wfit: tune the fit, used for carving slots in mount
+// ridge_hfit: adjust height of ridges when carving out the capsule rests
+// solid: make the capsule holder solid, used in the mount code to carve the capsule rests
+
+module capsule (mounts, twist, ridge, ridge_wfit = 0.0, ridge_hfit = 0.0, solid = 0) {
+    difference () {
+        union () {
+            // main capsule holder
+            cylinder(r = capsule_radius + wall, h = capsule_height, $fn = cfacets);
+            // the mounting legs
+            for (angles = mounts) {
+                rotate([0, 0, angles[0] + twist]) {
+                    // connect with cylindrical beams, very pretty
+                    if (connect == 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]) {
+                                cylinder(d = leg_width, h = leg_length - 0.3, center = false, $fn = facets);
+                            }
+                        }
+                    }
+                    // connect with horizontal legs
+                    if (connect == 1) {
+                        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;
+                        translate([0, - leg_width / 3, 0]) {
+                            difference() {
+                                cube([leg_length, leg_width, leg_thick]);
+                                // cut slot in connector
+                                translate([leg_length - slot_depth - slot_xtra_depth - fit, leg_width / 3 - (fit / 2), 0]) {
+                                    cube([slot_depth + slot_xtra_depth + fit, leg_width / 3 + fit, leg_thick]);
+                                }
+                            }
+                        }
+                    }
+                    // connect with vertical legs
+                    if (connect == 2) {
+                        // 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]));
+                        translate([capsule_radius - leg_thick / 2 + fudge, - leg_width / 3,
+                                   - leg_length + capsule_height]) {
+                            difference() {
+                                // the connection
+                                difference() {
+                                    cube([leg_thick + leg_thick / 2, leg_width, leg_length]);
+                                    translate([-leg_thick + wall - fudge, 0, - capsule_height + fudge]) {
+                                        cube([leg_thick, leg_width, leg_length]);
+                                    }
+                                }
+                                // cut slot in connector
+                                translate([0, leg_width / 3 - (fit / 2), 0]) {
+                                    cube([leg_thick + leg_thick / 2, leg_width / 3 + fit, slot_depth]);
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+            // add ridges for microphone mount
+            ridge_length = (mic_radius - capsule_height) / tan(elev_angle) - (capsule_radius + wall);
+            if (ridge == 2) {
+                rotate([0, 0, twist]) {
+                    translate([capsule_radius + wall - ridge_length / 2, (ridge_width + ridge_wfit) / 2, 0]) {
+                        cube([ridge_length * 3 / 2, ridge_width + ridge_wfit, capsule_height + ridge_hfit], center = false);
+                    }
+                    translate([capsule_radius + wall - ridge_length / 2, - (ridge_width + ridge_wfit) * 3 / 2, 0]) {
+                        cube([ridge_length * 3 / 2, ridge_width + ridge_wfit, capsule_height + ridge_hfit], center = false);
+                    }
+                }
+            }
+            if (ridge == 1) {
+                rotate([0, 0, twist]) {
+                    difference() {
+                        translate([capsule_radius + wall / 2, - (ridge_width + ridge_wfit) / 2, 0]) {
+                            cube([ridge_depth + wall / 2, ridge_width + ridge_wfit, capsule_height + ridge_hfit], center = false);
+                        }
+                        translate([capsule_radius + wall + ridge_length, - (ridge_width + ridge_wfit) / 2, 0]) {
+                            rotate([0, elev_angle, 0]) {
+                                cube([ridge_depth, ridge_width + ridge_wfit, capsule_height * 2], center = false);
+                            }
+                        }
+                    }
+                }
+            }
+        }
+        // make the hole for the capsule (also cuts leg overhang for vertical connectors)
+        if (solid != 1) {
+            translate ([0, 0, -capsule_height]) {
+                cylinder(r = capsule_radius + fudge, h = capsule_height * 2, $fn = cfacets);
+            }
+        }
+        // remove any extra connecting beam material from the face of the holder
+        if (connect == 0) {
+            translate ([0, 0, capsule_height]) {
+                cylinder(r = capsule_radius + wall * 2, h = 2, $fn = cfacets);
+            }
+        }
+    }
+}
+

+ 0 - 110
TinySpHEAR_common.scad

@@ -145,116 +145,6 @@ capsule_sep_max = mic_radius * cos(elev_angle) - (capsule_radius + wall) * sin(e
 capsule_bottom = mic_radius * sin(elev_angle) + (capsule_radius + wall) * cos(elev_angle);
 mount_radius_capsule = capsule_sep_max;
 
-////////
-// microphone capsule holder
-
-// mounts: vectors containing the angle of the mount and the angle to the adjacent capsule
-// twist: rotate the whole capsule to match mounting legs
-// ridge: add 0, 1 or 2 ridges for attaching the structure to the mount
-// ridge_wfit: tune the fit, used for carving slots in mount
-// ridge_hfit: adjust height of ridges when carving out the capsule rests
-// solid: make the capsule holder solid, used in the mount code to carve the capsule rests
-
-module capsule (mounts, twist, ridge, ridge_wfit = 0.0, ridge_hfit = 0.0, solid = 0) {
-    difference () {
-        union () {
-            // main capsule holder
-            cylinder(r = capsule_radius + wall, h = capsule_height, $fn = cfacets);
-            // the mounting legs
-            for (angles = mounts) {
-                rotate([0, 0, angles[0] + twist]) {
-                    // connect with cylindrical beams, very pretty
-                    if (connect == 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]) {
-                                cylinder(d = leg_width, h = leg_length - 0.3, center = false, $fn = facets);
-                            }
-                        }
-                    }
-                    // connect with horizontal legs
-                    if (connect == 1) {
-                        leg_length = (mic_radius - capsule_height + leg_thick) * tan(90 - angles[1]) - capsule_radius;
-                        slot_depth = leg_thick * cos(90 - 2 * angles[1]) + wall + fit;
-                        translate([capsule_radius + leg_length + fudge, - leg_width / 3, 0]) {
-                            rotate([0, -90, 0]) {
-                                difference() {
-                                    // thickness, width
-                                    cube([leg_thick, leg_width, leg_length]);
-                                    // cut slot in connector
-                                    translate([0, leg_width / 3 - (fit / 2), 0]) {
-                                        cube([leg_thick, leg_width / 3 + fit, slot_depth]);
-                                    }
-                                }
-                            }
-                        }
-                    }
-                    // connect with vertical legs
-                    if (connect == 2) {
-                        // 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]));
-                        translate([capsule_radius - leg_thick / 2 + fudge, - leg_width / 3,
-                                   - leg_length + capsule_height]) {
-                            difference() {
-                                // the connection
-                                difference() {
-                                    cube([leg_thick + leg_thick / 2, leg_width, leg_length]);
-                                    translate([-leg_thick + wall - fudge, 0, - capsule_height + fudge]) {
-                                        cube([leg_thick, leg_width, leg_length]);
-                                    }
-                                }
-                                // cut slot in connector
-                                translate([0, leg_width / 3 - (fit / 2), 0]) {
-                                    cube([leg_thick + leg_thick / 2, leg_width / 3 + fit, slot_depth]);
-                                }
-                            }
-                        }
-                    }
-                }
-            }
-            // add ridges for microphone mount
-            ridge_length = (mic_radius - capsule_height) / tan(elev_angle) - (capsule_radius + wall);
-            if (ridge == 2) {
-                rotate([0, 0, twist]) {
-                    translate([capsule_radius + wall - ridge_length / 2, (ridge_width + ridge_wfit) / 2, 0]) {
-                        cube([ridge_length * 3 / 2, ridge_width + ridge_wfit, capsule_height + ridge_hfit], center = false);
-                    }
-                    translate([capsule_radius + wall - ridge_length / 2, - (ridge_width + ridge_wfit) * 3 / 2, 0]) {
-                        cube([ridge_length * 3 / 2, ridge_width + ridge_wfit, capsule_height + ridge_hfit], center = false);
-                    }
-                }
-            }
-            if (ridge == 1) {
-                rotate([0, 0, twist]) {
-                    difference() {
-                        translate([capsule_radius + wall - ridge_length / 2, - (ridge_width + ridge_wfit) / 2, 0]) {
-                            cube([ridge_depth, ridge_width + ridge_wfit, capsule_height + ridge_hfit], center = false);
-                        }
-                        translate([capsule_radius + wall + ridge_length, - (ridge_width + ridge_wfit) / 2, 0]) {
-                            rotate([0, elev_angle, 0]) {
-                                cube([ridge_depth, ridge_width + ridge_wfit, capsule_height * 2], center = false);
-                            }
-                        }
-                    }
-                }
-            }
-        }
-        // make the hole for the capsule (also cuts leg overhang for vertical connectors)
-        if (solid != 1) {
-            translate ([0, 0, -capsule_height]) {
-                cylinder(r = capsule_radius + fudge, h = capsule_height * 2, $fn = cfacets);
-            }
-        }
-        // remove any extra connecting beam material from the face of the holder
-        if (connect == 0) {
-            translate ([0, 0, capsule_height]) {
-                cylinder(r = capsule_radius + wall * 2, h = 2, $fn = cfacets);
-            }
-        }
-    }
-}
-
 // simple microphone mount, clips into standard microphone stand
 //
 // angles: angles for mount slots