Jelajahi Sumber

first merge of changes from the octathingy microphone so that main modules are equivalent

Fernando Pablo Lopez-Lezcano 11 tahun lalu
induk
melakukan
90f10e292f
1 mengubah file dengan 31 tambahan dan 22 penghapusan
  1. 31 22
      first_order.scad

+ 31 - 22
first_order.scad

@@ -45,6 +45,9 @@ leg_thick = 2.5;
 ridge_width = 2;
 ridge_length = 2;
 
+// wall thickness of capsule holder
+wall = 1;
+
 // dimensions of microphone holder
 mount_radius = 3.5;
 
@@ -74,6 +77,20 @@ connect = 1;
 // 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 radius of the capsule
 //   measured inside diameter of a trial print was around 7.5 to 8.2 
 //   instead of 10, capsule diameter was 9.99)
@@ -82,22 +99,9 @@ fudge = 0.15;
 // adjustment for fit of slots in connection legs and mount
 fit = 0.2;
 
-// wall thickness of cylinders
-wall = 1;
-
-// number of facets for cylinders
+// number of facets for rendering cylinders
 facets = 64;
 
-// the rest of the connection leg geometry
-leg_length = 
-	connect == 0 ?
-		mic_radius * cos(elev_angle) - capsule_radius * sin(elev_angle) :
-		connect == 1 ? 
-			(mic_radius - capsule_height + leg_thick) * cos(elev_angle) / cos(90 - elev_angle) - capsule_radius : 
-			mic_radius - (capsule_radius / sqrt(2));
-slot_depth = connect == 1 ?
-	leg_thick * cos(elev_angle) / sin(elev_angle) + fit: leg_thick * cos (90 - (2 * elev_angle));
-
 // microphone holder 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);
@@ -109,7 +113,7 @@ mount_slot_depth = ridge_length * sin(elev_angle);
 
 // azimuth: horizontal orientation of the capsule
 // elevation: vertical orientation of the capsure
-// mounts: vector with angles that correspond to the orientation of the legs
+// 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
 
@@ -122,18 +126,21 @@ module capsule (azimuth, elevation, mounts, twist, ridge) {
 						// main capsule holder
 						cylinder(r = capsule_radius + wall, h = capsule_height, $fn = facets);	
 						// the mounting legs
-						for (rot = mounts) {
-							rotate(a = rot + twist, v = [0, 0, 1]) {
+						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 - elev_angle, 0]) {
+										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]) + fit;
 									translate([capsule_radius + leg_length + fudge, - leg_width / 3, 0]) {
 										rotate([0, -90, 0]) {
 											difference() {
@@ -149,6 +156,8 @@ module capsule (azimuth, elevation, mounts, twist, ridge) {
 								}
 								// connect with vertical legs
 								if (connect == 2) {
+                                    leg_length = (mic_radius * tan(90 - angles[1]) - capsule_radius) * tan(angles[1]); 
+                                    slot_depth = leg_thick * cos (90 - (2 * angles[1]));
 									translate([capsule_radius + fudge, - leg_width / 3, - leg_length + capsule_height]) {
 										difference() {
 											// thickness, width
@@ -237,10 +246,10 @@ module mount (angles, wall, separation) {
 
 // render a complete microphone
 if (rendermic == 1) {
-	capsule(45, elev_angle, [-120, 0, 120], 60, 0);
-	capsule(-45, -elev_angle, [-120, 120], 0, 1);
-	capsule(-135, elev_angle, [-120, 0, 120], 60, 0);
-	capsule(135, -elev_angle, [-120, 120], 0, 1);
+	capsule(45, elev_angle, leg_angles_top, 60, 0);
+	capsule(-135, elev_angle, leg_angles_top, 60, 0);
+	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);
 }