1
0
Эх сурвалжийг харах

completely rework mount == 2, legs are now completely parametric, it took me some time...

Fernando Pablo Lopez-Lezcano 11 жил өмнө
parent
commit
f16febc2c0
1 өөрчлөгдсөн 138 нэмэгдсэн , 41 устгасан
  1. 138 41
      first_order.scad

+ 138 - 41
first_order.scad

@@ -1,35 +1,50 @@
 //
-// First Order (B-format) Ambisonics Microphone, or SphEAR for short
+// SphEAR, First Order (B-format) Ambisonics Microphone
 //
-// Copyright 2015 Fernando Lopez-Lezcano
+// Copyright 2015, Fernando Lopez-Lezcano, All Rights Reserved
 //
 // Source code released under the GNU GPL License
 // http://www.gnu.org/licenses/gpl-3.0.en.html
 //
-// 3d model released under Creative Commons Non-Commercial Share-Alike
+// 3d models released under Creative Commons Non-Commercial Share-Alike
 // CC-NC-SA 3.0
 // http://creativecommons.org/licenses/by-nc-sa/3.0/
+//
+// https://en.wikipedia.org/wiki/Tetrahedron
+// angle capsule to vertical = atan(sqrt(2)) = 54.7356103172
+
 
 //// model parameters
 
 // dimensions for the EM182 electret microphone
-mic_radius = 5;
-mic_height = 4.5;
+capsule_radius = 5;
+capsule_height = 4.5;
 
 // distance between face of capsule and center of array
-amb_radius = 12.5;
+mic_radius = 11;
+
+// separation between capsules (right now only used in stalk)
+cap_sep = 7;
+
+// dimensions of capsule holder legs
+leg_width = 4;
+leg_thick = 2.5;
+leg_length = mic_radius - (capsule_radius / sqrt(2));
+slot_depth = leg_thick;
 
 // dimensions of microphone holder
 hold_radius = 4;
 
-// separation between capsules (right now only used in stalk)
-cap_sep = 7;
+//// end of model parameters
+
+//// rendering control
 
 // what to render:
-// 0 -> a single capsule holder
+// 0 -> ready to print
+//   set = 0 -> one capsule, set = 1 -> four capsules
 // 1 -> the whole microhone with four capsules
-
 rendermic = 1;
+renderset = 0;
 
 // what type of connection between capsule holders:
 // 0 -> original cylinder beams
@@ -37,13 +52,18 @@ rendermic = 1;
 // 2 -> interlocking beams (in)
 connect = 2;
 
+//// end of rendering control
+
 // adjustment for the size of the capsule
 //   (measured inside diameter was around 7.5 to 8.2 instead of 10, capsule diameter was 9.99)
 fudge = 0.15;
 
-// adjustment for fit of ridges
+// adjustment for fit of slots
 fit = 0.2;
 
+// wall thickness of cylinders
+wall = 1;
+
 // number of facets for cylinders
 facets = 64;
 
@@ -52,28 +72,100 @@ facets = 64;
 
 // azimuth: orientation of the capsule
 // elevation: orientation of the capsure
-// separation: how far from the center to displace the capsule
-// radius: radius of the microphone
-// height: height of the microphone
-// wall: thickness of the microphone housing walls
 // twist: adjust the angle of the mounts so they match
 // mounts: number of mounts to create (2 or 3)
 
-module capsule (azimuth, elevation, ambradius, radius, height, wall, twist, mounts) {
+module capsule (azimuth, elevation, twist, mounts) {
+	rotate([0, 0, azimuth]) {
+		rotate([0, (90 - elevation), 0]) {
+  			translate([0, 0, rendermic == 0 ? 0 : mic_radius - capsule_height]) {
+				// the capsule holder
+				difference () {
+					union () {
+						// main capsule holder
+						cylinder(r = capsule_radius + wall, h = capsule_height, $fn = facets);	
+						// the attachment point to the other capsules
+						for (rot = [-120 : 120 : mounts == 2 ? 0 : 120]) {
+							rotate(a = rot + twist, v = [0, 0, 1]) {
+								// connect with cylindrical beams, very pretty
+								if (connect == 0) {
+									translate([capsule_radius - wall, 0, capsule_height - wall]) {
+										rotate(a = 145, v = [0, 1, 0]) {
+											cylinder(d = wall * 4, h = 6, center = false, $fn = facets);
+										}
+									}
+								}
+								// connect with flat square beams pointing out
+								if (connect == 1) {
+									translate([capsule_radius - wall, 3 * wall / 4, wall]) {
+										rotate(a = 90, v = [0, 1, 0]) {
+											difference() {
+												cube([wall * 2, wall * 4, capsule_height * 4], center = true);
+												translate([0, 0, wall * 8]) {
+													cube([wall * 2, wall * 1.5, capsule_height], center = true);
+												}
+											}
+										}
+									}
+								}
+								// connect with vertical legs
+								if (connect == 2) {
+									translate([capsule_radius + fudge, - leg_width / 3, - leg_length + capsule_height]) {
+										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]);
+											}
+										}
+									}
+								}
+							}
+						}
+						// add ridges for microphone mount
+						if (mounts == 2) {
+							rotate(a = 120 + twist, v = [0, 0, 1]) {
+								translate([capsule_radius + fudge, - wall , 0]) {
+									difference() {
+										cube([wall * 3, wall * 2, capsule_height], center = false);
+										rotate([0, 55, 0]) {
+											cube([wall * 3, wall * 2, capsule_height], center = false);
+										}
+									}
+								}
+							}
+						}
+					}
+					// make the hole for the capsule
+					translate ([0, 0, -2]) {
+						cylinder(r = capsule_radius + fudge, h = capsule_height + 2, $fn = facets);
+					}
+					// remove any extra connecting beam material from the face of the holder
+					//translate ([0, 0, capsule_height]) {
+					//	cylinder(r = capsule_radius + wall * 2, h = 2, $fn = facets);
+					//}
+				}
+			}
+		}
+	}
+}
+
+module capsule_old (azimuth, elevation, micradius, cap_radius, cap_height, wall, twist, mounts) {
 	rotate([0, 0, azimuth]) {
 		rotate([0, (90 - elevation), 0]) {
-  			translate([0, 0, ambradius - height]) {
+  			translate([0, 0, mic_radius - capsule_height]) {
 				// the capsule holder
 				difference () {
 					union () {
 						// main capsule holder
-						cylinder(r = radius + wall, h = height, $fn = facets);	
+						cylinder(r = capsule_radius + wall, h = capsule_height, $fn = facets);	
 						// the attachment point to the other capsules
 						for (rot = [-120 : 120 : mounts == 2 ? 0 : 120]) {
 							// connect with cylindrical beams, very pretty
 							rotate(a = rot + twist, v = [0, 0, 1]) {
 								if (connect == 0) {
-									translate([radius - wall, 0, height - wall]) {
+									translate([capsule_radius - wall, 0, capsule_height - wall]) {
 										rotate(a = 145, v = [0, 1, 0]) {
 											cylinder(d = wall * 4, h = 6, center = false, $fn = facets);
 										}
@@ -81,12 +173,12 @@ module capsule (azimuth, elevation, ambradius, radius, height, wall, twist, moun
 								}
 								// connect with flat square beams pointing out
 								if (connect == 1) {
-									translate([radius - wall, 3 * wall / 4, wall]) {
+									translate([capsule_radius - wall, 3 * wall / 4, wall]) {
 										rotate(a = 90, v = [0, 1, 0]) {
 											difference() {
-												cube([wall * 2, wall * 4, height * 4], center = true);
+												cube([wall * 2, wall * 4, capsule_height * 4], center = true);
 												translate([0, 0, wall * 8]) {
-													cube([wall * 2, wall * 1.5, height], center = true);
+													cube([wall * 2, wall * 1.5, capsule_height], center = true);
 												}
 											}
 										}
@@ -94,11 +186,11 @@ module capsule (azimuth, elevation, ambradius, radius, height, wall, twist, moun
 								}
 								// connect with flat square beams pointing in
 								if (connect == 2) {
-									translate([radius + fudge, - wall * 1.29 , - height]) {
+									translate([capsule_radius + fudge, - wall * 1.29 , - capsule_height]) {
 										difference() {
-											cube([wall * 3, wall * 4, height * 2], center = false);
+											cube([wall * 3, wall * 4, capsule_height * 2], center = false);
 											translate([0, wall * 1.25, - wall * 2]) {
-												cube([wall * 3, wall * 1.5, height], center = false);
+												cube([wall * 3, wall * 1.5, capsule_height], center = false);
 											}
 										}
 									}
@@ -107,11 +199,11 @@ module capsule (azimuth, elevation, ambradius, radius, height, wall, twist, moun
 						}
 						// add ridges for microphone mount
 						rotate(a = 120 + twist, v = [0, 0, 1]) {
-							translate([radius + fudge, - wall , 0]) {
+							translate([capsule_radius + fudge, - wall , 0]) {
 								difference() {
-									cube([wall * 3, wall * 2, height], center = false);
+									cube([wall * 3, wall * 2, capsule_height], center = false);
 									rotate([0, 55, 0]) {
-										cube([wall * 3, wall * 2, height], center = false);
+										cube([wall * 3, wall * 2, capsule_height], center = false);
 									}
 								}
 							}
@@ -119,11 +211,11 @@ module capsule (azimuth, elevation, ambradius, radius, height, wall, twist, moun
 					}
 					// make the hole for the capsule
 					translate ([0, 0, -2]) {
-						cylinder(r = radius + fudge, h = height + 2, $fn = facets);
+						cylinder(r = capsule_radius + fudge, h = capsule_height + 2, $fn = facets);
 					}
 					// remove any extra connecting beam material from the face of the holder
-					translate ([0, 0, height]) {
-						cylinder(r = radius + wall * 2, h = 2, $fn = facets);
+					translate ([0, 0, capsule_height]) {
+						cylinder(r = capsule_radius + wall * 2, h = 2, $fn = facets);
 					}
 				}
 			}
@@ -172,6 +264,9 @@ module mount (radius, length, wall, separation) {
 	}
 }
 
+// some constants
+vang = atan(sqrt(2));
+
 // vectors pointing in the directions of the four capsules
 direction1 = [1, 1, 1];
 direction2 = [-1, 1, -1];
@@ -194,21 +289,23 @@ el4 = -asin(1/dist);
 
 // connect the four instances together
 if (rendermic == 1) {
-	capsule(az1, el1, amb_radius, mic_radius, mic_height, 1, 60, 3);
-	capsule(az2, el2, amb_radius, mic_radius, mic_height, 1, 240, 2);
-	capsule(az3, el3, amb_radius, mic_radius, mic_height, 1, 60, 3);
-	capsule(az4, el4, amb_radius, mic_radius, mic_height, 1, 240, 2);
+	capsule(az1, el1, 60, 3);
+	capsule(az2, el2, 240, 2);
+	capsule(az3, el3, 60, 3);
+	capsule(az4, el4, 240, 2);
 	// the mount
-	mount(hold_radius, mic_height, 1, amb_radius);
+	//mount(hold_radius, capsule_height, 1, mic_radius);
 }
 
-part_sep = mic_radius * 2 * 3;
+part_sep = capsule_radius * 2 * 3;
+
+echo("az = ", az1, az2, az3, az4, "elev = ", el1, el2, el3, el4);
 
 // just one to test
 if (rendermic == 0) {
-	capsule(0, 270, height, mic_radius, mic_height, 1, 0);
-	translate([0, part_sep, 0]) { capsule(0, 270, height, mic_radius, mic_height, 1, 0); }
-	translate([part_sep, 0, 0]) { capsule(0, 270, height, mic_radius, mic_height, 1, 0); }
-	translate([part_sep, part_sep]) { capsule(0, 270, height, mic_radius, mic_height, 1, 0); }
+	capsule(0, 90, 0, 3);
+	//translate([0, part_sep, 0]) { capsule(0, 270, height, capsule_radius, capsule_height, 1, 0); }
+	//translate([part_sep, 0, 0]) { capsule(0, 270, height, capsule_radius, capsule_height, 1, 0); }
+	//translate([part_sep, part_sep]) { capsule(0, 270, height, capsule_radius, capsule_height, 1, 0); }
 }