Преглед изворни кода

almost done with the parametrization of the microphone mount, I modified the capsule code to be able to use it to automatically create the right indentations in the mount - I still need to get the depth of the capsule holder indentations to be parametric, ties loose ends and clean up a lot of code

Fernando Pablo Lopez-Lezcano пре 10 година
родитељ
комит
67cb5a3edf
1 измењених фајлова са 59 додато и 41 уклоњено
  1. 59 41
      TinySphEAR.scad

+ 59 - 41
TinySphEAR.scad

@@ -45,19 +45,19 @@ leg_thick = 2.5;
 // width of the ridge that connects to the mount
 ridge_width = 2.0;
 ridge_slot_width = 2;
-ridge_length = 2.5;
 
 // wall thickness of capsule holder
 wall = 1;
 
 // dimensions of microphone holder
-mount_radius = 3.5;
+mount_radius = 2.5;
 
 // height of mount
 mount_height = 30;
 
 // height of sleeve
-sleeve_height = 25;
+sleeve_height = 20;
+sleeve_wall = 0.75;
 
 //// end of model parameters
 ////
@@ -74,7 +74,7 @@ renderset = 0;
 // 0 -> original cylinder beams
 // 1 -> interlocking beams (out)
 // 2 -> interlocking beams (in)
-connect = 1;
+connect = 2;
 
 // what type of mount ridges to use
 // 0 -> nothing
@@ -118,6 +118,7 @@ capsule_sep_min = (mic_radius - capsule_height) * cos(elev_angle) - (capsule_rad
 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_slot_depth = ridge_length * sin(elev_angle);
+mount_radius_capsule = capsule_sep_max;
 
 ////////
 // microphone capsule holder
@@ -127,8 +128,9 @@ mount_slot_depth = ridge_length * sin(elev_angle);
 // 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: 1 -> print ridge for mount
+// solid: make the capsule holder solid, used in the mount to carve the capsule rests
 
-module capsule (azimuth, elevation, mounts, twist, ridge) {
+module capsule (azimuth, elevation, mounts, twist, ridge, solid = 0) {
 	rotate([0, 0, azimuth]) {
 		rotate([0, (90 - elevation), 0]) {
   			translate([0, 0, rendermic == 0 ? 0 : mic_radius - capsule_height]) {
@@ -176,8 +178,8 @@ module capsule (azimuth, elevation, mounts, twist, ridge) {
 											// thickness, width
                                             difference() {
                                                 cube([leg_thick + leg_thick / 2, leg_width, leg_length]);
-                                                translate([0, 0, -capsule_height + fudge]) {
-                                                    cube([leg_thick / 2, leg_width, leg_length]);
+                                                translate([-leg_thick / 2 + wall - fudge, 0, - capsule_height + fudge]) {
+                                                    cube([leg_thick, leg_width, leg_length]);
                                                 }
                                             }
 											// cut slot in connector
@@ -190,28 +192,31 @@ module capsule (azimuth, elevation, mounts, twist, ridge) {
 							}
 						}
 						// 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 - ridge_length / 2 + fudge, ridge_slot_width / 2, 0]) {
+								translate([capsule_radius + wall - ridge_length / 2, ridge_slot_width / 2, 0]) {
                                     cube([ridge_length * 3 / 2, ridge_width, capsule_height], center = false);
 								}
-								translate([capsule_radius - ridge_length / 2 + fudge, -ridge_width - ridge_slot_width / 2, 0]) {
+								translate([capsule_radius + wall - ridge_length / 2, -ridge_width - ridge_slot_width / 2, 0]) {
                                     cube([ridge_length * 3 / 2, ridge_width, capsule_height], center = false);
 								}
 							}
 						}
 						if (ridge == 1) {
 							rotate([0, 0, twist]) {
-								translate([capsule_radius - ridge_length / 2 + fudge, -ridge_width / 2, 0]) {
+								translate([capsule_radius + wall - ridge_length / 2, -ridge_width / 2, 0]) {
                                     cube([ridge_length * 3 / 2, ridge_width, capsule_height], center = false);
 								}
 							}
 						}
 					}
 					// make the hole for the capsule
-					translate ([0, 0, 0]) {
-						cylinder(r = capsule_radius + fudge, h = capsule_height, $fn = facets);
-					}
+					if (solid != 1) {
+                        translate ([0, 0, 0]) {
+                            cylinder(r = capsule_radius + fudge, h = capsule_height, $fn = facets);
+                        }
+                    }
 					// remove any extra connecting beam material from the face of the holder
 					if (connect == 0) {
 						translate ([0, 0, capsule_height]) {
@@ -231,40 +236,53 @@ module capsule (azimuth, elevation, mounts, twist, ridge) {
 // separation: height of mount with respect of the microphone assembly
 
 module mount (angles, wall, separation) {
-	translate([0, 0, -(separation + 0.0)]) {
+    capsule_indent = (capsule_radius * cos(elev_angle)) * 1.25;
+    cone_height = 5;
+	translate([0, 0, -(separation - 0)]) {
 		difference() {
             union() {
-                // main mount cylinder
+                // conic section
+                translate([0, 0, -cone_height]) {
+                    difference() {
+                        cylinder(r2 = mount_radius_capsule, r1 = mount_radius + wall, h = cone_height, $fn = facets);
+                        // make the hole for the mount (* 1.5 to cut the ridge as well)
+                        cylinder(r2 = mount_radius_capsule - wall, r1 = mount_radius, h = cone_height * 1.5, $fn = facets);
+                    }
+                }
                 translate([0, 0, -mount_height]) {
                     difference() {
-                        cylinder(r = mount_radius + wall, h = mount_height, $fn = facets);
+                        cylinder(r = mount_radius + wall, h = mount_height - cone_height, $fn = facets);
                         // make the hole for the mount (* 1.5 to cut the ridge as well)
-                        cylinder(r = mount_radius, h = mount_height * 1.5, $fn = facets);
+                        cylinder(r = mount_radius, h = (mount_height - cone_height) * 1.5, $fn = facets);
                     }
                 }
             }
             // indentations that match the lower capsule holders
-            for (rot = angles) {
-                rotate([0, 0, rot + 45]) {
-                    translate([-mount_radius * 1.6, mount_radius * 1.6, 8.0 / 3]) {
-                        rotate([0, 90 - elev_angle, -45]) {
-                            cylinder(r = capsule_radius + wall, h = capsule_height * 2, $fn = facets);
-                        }
-                    }
-                }
+            translate([0, 0, separation - capsule_height * cos (elev_angle)]) {
+                capsule(-45, -elev_angle, [], 0, 1);
+                capsule(135, -elev_angle, [], 0, 1);
             }
+//            %for (rot = angles) {
+//                rotate([0, 0, rot]) {
+//                    translate([mount_radius_capsule, 0, capsule_indent]) {
+//                        rotate([0, 90 + elev_angle, 0]) {
+//                            cylinder(r = capsule_radius + wall, h = capsule_height * 2, $fn = facets);
+//                        }
+//                    }
+//                }
+//            }
             // slots for the mounting ridges
-            for (rot = angles) {
-                rotate([0, -elev_angle, rot]) {
-                    translate([-capsule_sep_max * 2, -ridge_width / 2, mount_slot_depth - 2 * wall]) {
-                        cube([capsule_sep_max * 2, ridge_width + fit, mount_height]);
-                    }
-                }
-			}
+//            for (rot = angles) {
+//                rotate([0, -elev_angle, rot]) {
+//                    translate([-capsule_sep_max * 2, -ridge_width / 2, mount_slot_depth - 2 * wall]) {
+//                        cube([capsule_sep_max * 2, ridge_width + fit, mount_height]);
+//                    }
+//                }
+//			}
             // slice it open so we can pop in cables
             rotate([0, 0, 45]) {
-                translate([mount_radius - wall / 2, - wall / 2, -mount_height]) {
-                    cube([2 * wall, wall, mount_height]);
+                translate([mount_radius - fudge, - wall / 2, -mount_height]) {
+                    cube([mount_radius_capsule - mount_radius + fudge, wall, mount_height]);
                 }
             }
         }
@@ -416,9 +434,9 @@ if (rendermic == 1) {
 	capsule(-45, -elev_angle, leg_angles_bot, 0, 1);
     capsule(135, -elev_angle, leg_angles_bot, 0, 1);
 	// the mount
-	mount([-45, 135], 1, capsule_bottom);
+	mount([-45, 135], wall, capsule_bottom);
     // the sleeve closing it
-    mount_sleeve(1, capsule_bottom);
+    mount_sleeve(sleeve_wall, capsule_bottom);
 }
 
 // print all the parts separately
@@ -463,15 +481,15 @@ if (rendermic == 0) {
         translate([part_sep, -part_sep, part_height]) { capsule(0, part_rot, leg_angles_top, 0, 0); }
         if (renderset != 0) {
             // #4
-            translate([part_sep, part_sep, part_height]) { capsule(0, part_rot, leg_angles_top, 0, 0); }
+            *translate([part_sep, part_sep, part_height]) { capsule(0, part_rot, leg_angles_top, 0, 0); }
             // #2
-            translate([-part_sep, part_sep, part_height]) { capsule(0, part_rot, leg_angles_bot, -90, 1); }
+            *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); }
+            *translate([-part_sep, -part_sep, part_height]) { capsule(0, part_rot, leg_angles_bot, 90, 1); }
             // mount
-            translate([0, 0, mount_height]) { mount([-45, 135], 1, 0); }
+            *translate([0, 0, mount_height]) { mount([-45, 135], 1, 0); }
             // add connecting ridges to make it all one part
-            difference() {
+            *difference() {
                 for (rot_a = [-45, 45]) {
                     rotate([0, 0, rot_a]) {
                         translate([-wall / 2, -part_sep * 0.85, 0]) {