Ver código fonte

tweak parameters for the 10mm EM182 print, remove code that has been moved to TinySpHEAR_common, change capsule module interface to match the new code

Fernando Pablo Lopez-Lezcano 10 anos atrás
pai
commit
704ea58285
1 arquivos alterados com 19 adições e 237 exclusões
  1. 19 237
      TinySphEAR.scad

+ 19 - 237
TinySphEAR.scad

@@ -24,9 +24,7 @@
 //   Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)
 // http://creativecommons.org/licenses/by-nc-sa/4.0/
 
-
-// https://en.wikipedia.org/wiki/Tetrahedron
-// angle of capsule to vertical axis = atan(sqrt(2)) = 54.7356103172
+include <TinySpHEAR_common.scad>;
 
 ////
 //// model parameters
@@ -44,7 +42,7 @@ 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 = 3;
+leg_thick = 1.75;
 
 // wall thickness of the capsule holder
 wall = 1;
@@ -54,15 +52,16 @@ wall = 1;
 ridge_width = 2.0;
 ridge_slot_width = 2.0;
 // add to the thickness of ridges
-ridge_fit = 0.1;
+ridge_wfit = 0.1;
+ridge_hfit = 3;
 
 // dimensions of microphone mount
-mount_radius = 4.0;
+mount_radius = 3.5;
 mount_wall = 0.75;
 
 // height and eccentricity of top connector
 mount_top_height = 15.0;
-mount_top_eccentricity = 1.25;
+mount_top_eccentricity = 1.3;
 
 // height of mount
 mount_height = 40;
@@ -111,246 +110,29 @@ ridges = 1;
 //// end of rendering control
 ////
 
-// elevation angle for the capsule holders (fixed for this microphone)
-elev_angle = atan(sqrt(1/2));
-
-// angles of the connection legs and adjacent capsule holders
-leg_angles_top = 
-    [
-        [-120, elev_angle], 
-        [0, elev_angle],
-        [120, elev_angle]
-    ];
-
-leg_angles_bot = 
-    [
-        [-120, elev_angle], 
-        [120, elev_angle]
-    ];
-
 // 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)
-fudge = 0.15;
+fudge = 0.08;
 
 // adjustment for fit of slots in connection legs and mount
-fit = 0.1;
+// 0.1: initial setting
+// 0.1 ->0.2: Ultimaker 2 + Extended plus APL (2016.06.10)
+fit = 0.15;
 
 // number of facets for rendering cylinders
 facets = 64;
-
-// microphone structure geometry
-capsule_sep_min = (mic_radius - capsule_height) * cos(elev_angle) - (capsule_radius + wall) * sin(elev_angle);
-capsule_sep_max = mic_radius * cos(elev_angle) - (capsule_radius + wall) * sin(elev_angle);
-capsule_bottom = mic_radius * sin(elev_angle) + (capsule_radius + wall) * cos(elev_angle);
-mount_radius_capsule = capsule_sep_max;
-
-////////
-// microphone capsule holder
-
-// azimuth: horizontal orientation of the capsule
-// elevation: vertical orientation of the capsule
-// 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_fit: tune the fit, used for carving slots in mount
-// solid: make the capsule holder solid, used in the mount code to carve the capsule rests
-
-module capsule (azimuth, elevation, mounts, twist, ridge, ridge_fit = 0.0, solid = 0) {
-    rotate([0, 0, azimuth]) {
-        rotate([0, (90 - elevation), 0]) {
-            translate([0, 0, (rendermic == 0 && solid == 0) ? 0 : mic_radius - capsule_height]) {
-                difference () {
-                    union () {
-                        // main capsule holder
-                        cylinder(r = capsule_radius + wall, h = capsule_height, $fn = facets);    
-                        // 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_fit) / 2, 0]) {
-                                    cube([ridge_length * 3 / 2, ridge_width - ridge_fit, capsule_height], center = false);
-                                }
-                                translate([capsule_radius + wall - ridge_length / 2, - (ridge_width - ridge_fit) * 3 / 2, 0]) {
-                                    cube([ridge_length * 3 / 2, ridge_width - ridge_fit, capsule_height], center = false);
-                                }
-                            }
-                        }
-                        if (ridge == 1) {
-                            rotate([0, 0, twist]) {
-                                translate([capsule_radius + wall - ridge_length / 2, - (ridge_width - ridge_fit) / 2, 0]) {
-                                    cube([ridge_length * 3 / 2, ridge_width - ridge_fit, capsule_height], 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 = facets);
-                        }
-                    }
-                    // 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 = facets);
-                        }
-                    }
-                }
-            }
-        }
-    }
-}
-
-// microphone mount
-//
-// clips into standard microphone stand
-//
-// angles: angles for mount slots
-// wall: thickness of cylinder wall
-// stand_wall: thickness of stand mount wall
-// separation: height of mount with respect of the microphone assembly
-
-module ellipsoid(height, rad_bot, rad_top, eccentricity) {
-    linear_extrude(height = height, scale = [eccentricity, rad_top / rad_bot]) {
-        circle(r = rad_bot, $fn = facets); 
-    }
-}
-
-module mount (angles, wall, stand_wall, separation) {
-    translate([0, 0, -separation]) {
-        difference() {
-            union() {
-                // conic section
-                translate([0, 0, mic_mount_height + mount_height]) {
-                    rotate([0, 0, 45]) {
-                        difference() {
-                            ellipsoid(mount_top_height, mount_radius + wall, mount_radius_capsule, mount_top_eccentricity);
-                            ellipsoid(mount_top_height, mount_radius, mount_radius_capsule * 0.5, mount_top_eccentricity * 1.05);
-                        }
-                    }
-                }
-                // stalk
-                translate([0, 0, mic_mount_height + mount_height * 2/3]) {
-                    difference() {
-                        cylinder(r = mount_radius + wall, h = mount_height / 3, $fn = facets);
-                        // make the hole for the mount
-                        cylinder(r = mount_radius, h = mount_height / 3, $fn = facets);
-                    }
-                }
-                // transition to stand mount
-                translate([0, 0, mic_mount_height]) {
-                    difference() {
-                        cylinder(r2 = mount_radius + wall, r1 = mic_mount_radius + mic_mount_fit + stand_wall, 
-                                h = mount_height * 2 / 3, $fn = facets);
-                        // make the hole for the mount
-                        cylinder(r2 = mount_radius, r1 = mic_mount_radius + mic_mount_fit, 
-                                h = mount_height * 2 / 3, $fn = facets);
-                    }
-                }
-                // stand mount
-                translate([0, 0, 0]) {
-                    difference() {
-                        union() {
-                            // main mount cylinder
-                            translate([0, 0, 0]) {
-                                difference() {
-                                    cylinder(r = mic_mount_radius + mic_mount_fit + stand_wall, h = mic_mount_height, $fn = facets);
-                                    // make the hole for the mount (* 1.5 to cut the ridge as well)
-                                    cylinder(r = mic_mount_radius + mic_mount_fit, h = mic_mount_height, $fn = facets);
-                                }
-                            }
-                        }
-                        // slot for fitting into microphone stand
-                        translate([mic_mount_radius - stand_wall / 2, - mic_mount_slot_width / 2, 0]) {
-                            cube([2 * stand_wall, mic_mount_slot_width, mic_mount_slot_height]);
-                        }
-                        // eyelet for microphone stand
-                        translate([mic_mount_radius - stand_wall / 2, 0,  mic_mount_slot_height]) {
-                            rotate([0, 90, 0]) {
-                                cylinder(r = mic_mount_slot_radius, h = 2 * stand_wall, $fn = facets);
-                            }
-                        }
-                        // hole for microphone wiring
-                        translate([mic_mount_radius - stand_wall / 2, 0, mic_mount_height - mic_wire_hole_offset]) {
-                            rotate([0, 90, 0]) {
-                                cylinder(r = mic_wire_hole_radius, h = 2 * stand_wall, $fn = facets);
-                            }
-                        } 
-                    }
-                }
-            }
-            // indentations that match the two lower capsule holders
-            translate([0, 0, mic_mount_height + mount_height + mount_top_height + 
-                       (mic_radius - capsule_height) + capsule_height * sin(elev_angle)]) {
-                capsule(angles[0], -elev_angle, [], 0, 1, 0.1, 1);
-                capsule(angles[1], -elev_angle, [], 0, 1, 0.1, 1);
-            }
-        }
-    }
-}
+// render capsule holders with better resolution
+cfacets = 128;
 
 // render a complete microphone
 
 if (rendermic == 1) {
     // all four capsules
-    capsule(45, elev_angle, leg_angles_top, 60, 0, 0.0, 0);
-    capsule(-135, elev_angle, leg_angles_top, 60, 0, 0.0, 0);
-    capsule(-45, -elev_angle, leg_angles_bot, 0, 1, 0.0, 0);
-    capsule(135, -elev_angle, leg_angles_bot, 0, 1, 0.0, 0);
+    capsule(45, elev_angle, leg_angles_top, 60, 0, 0.0, 0.0, 0);
+    capsule(-135, elev_angle, leg_angles_top, 60, 0, 0.0, 0.0, 0);
+    capsule(-45, -elev_angle, leg_angles_bot, 0, 1, 0.0, 0.0, 0);
+    capsule(135, -elev_angle, leg_angles_bot, 0, 1, 0.0, 0.0, 0);
     // the mount
     mount([-45, 135], mount_wall, mic_mount_wall, mic_mount_height + mount_top_height + mount_height + capsule_bottom);
 }
@@ -366,13 +148,13 @@ if (rendermic == 0) {
         *translate([part_sep, -part_sep, part_height]) { capsule(0, part_rot, leg_angles_top, 60, 0); }
         if (renderset != 0) {
             // #4
-            *translate([part_sep, part_sep, part_height]) { capsule(0, part_rot, leg_angles_top, 60, 0); }
+            translate([part_sep, part_sep, part_height]) { capsule(0, part_rot, leg_angles_top, 60, 0); }
             // #2
             *translate([-part_sep, part_sep, part_height]) { capsule(0, part_rot, leg_angles_bot, -90, 1); }
             // #1
             *translate([-part_sep, -part_sep, part_height]) { capsule(0, part_rot, leg_angles_bot, 90, 1); }
             // mount body
-            translate([0, 0, 0]) { mount([-45, 135], mount_wall, mic_mount_wall, 0); }
+            *translate([0, 0, 0]) { mount([-45, 135], mount_wall, mic_mount_wall, 0); }
             // add connecting ridges to make it all one part
             *difference() {
                 for (rot_a = [-45, 45]) {
@@ -383,7 +165,7 @@ if (rendermic == 0) {
                     }
                 }
                 // remove them in the inside of the mount
-                cylinder(r = mount_radius + wall / 2, h = wall / 2);
+                *cylinder(r = mount_radius + wall / 2, h = wall / 2);
             }
         }
     } else {