Bladeren bron

send list of mounts as a vector parameter, allows us to reuse the same code for the octathingy

Fernando Pablo Lopez-Lezcano 11 jaren geleden
bovenliggende
commit
1aadb47e3b
1 gewijzigde bestanden met toevoegingen van 11 en 11 verwijderingen
  1. 11 11
      first_order.scad

+ 11 - 11
first_order.scad

@@ -94,7 +94,7 @@ capsule_bottom = mic_radius * cos(tetra) + capsule_radius * sin(tetra);
 // twist: adjust the angle of the mounts
 // mounts: number of mounts to create (2 for the bottom mics, 3 for the top)
 
-module capsule (azimuth, elevation, twist, mounts) {
+module capsule (azimuth, elevation, mounts, twist) {
 	rotate([0, 0, azimuth]) {
 		rotate([0, (90 - elevation), 0]) {
   			translate([0, 0, rendermic == 0 ? 0 : mic_radius - capsule_height]) {
@@ -104,7 +104,7 @@ module capsule (azimuth, elevation, twist, mounts) {
 						// main capsule holder
 						cylinder(r = capsule_radius + wall, h = capsule_height, $fn = facets);	
 						// the attachment point to the other capsules
-						for (rot = mounts == 2 ? [-120, 120] : [-120, 0, 120]) {
+						for (rot = mounts) {
 							rotate(a = rot + twist, v = [0, 0, 1]) {
 								// connect with cylindrical beams, very pretty
 								if (connect == 0) {
@@ -145,7 +145,7 @@ module capsule (azimuth, elevation, twist, mounts) {
 							}
 						}
 						// add ridges for microphone mount
-						if (mounts == 2) {
+						if (elevation < 0) {
 							rotate([0, 0, twist]) {
 								translate([capsule_radius + fudge, - wall , 0]) {
 									difference() {
@@ -211,10 +211,10 @@ elev = asin(1 / sqrt(3));
 
 // render a complete microphone
 if (rendermic == 1) {
-	capsule(45, elev, 60, 3);
-	capsule(-45, -elev, 0, 2);
-	capsule(-135, elev, 60, 3);
-	capsule(135, -elev, 0, 2);
+	capsule(45, elev, [-120, 0, 120], 60);
+	capsule(-45, -elev, [-120, 120], 0);
+	capsule(-135, elev, [-120, 0, 120], 60);
+	capsule(135, -elev, [-120, 120], 0);
 	// the mount
 	mount(1, capsule_bottom);
 }
@@ -222,11 +222,11 @@ if (rendermic == 1) {
 // print all the parts separately
 part_sep = capsule_radius * 2 * 3;
 if (rendermic == 0) {
-	capsule(0, -90, 0, 3);
+	capsule(0, -90, [-120, 0, 120], 0);
     if (renderset != 0) {
-        translate([0, part_sep, 0]) { capsule(0, -90, 0, 3); }
-        translate([part_sep, 0, 0]) { capsule(0, -90, 0, 2); }
-        translate([part_sep, part_sep]) { capsule(0, -90, 0, 2); }
+        translate([0, part_sep, 0]) { capsule(0, -90, [-120, 0, 120], 0); }
+        translate([part_sep, 0, 0]) { capsule(0, -90, [-120, 120], 0); }
+        translate([part_sep, part_sep]) { capsule(0, -90, [-120, 120], 0); }
         translate([part_sep / 2, -part_sep, 0]) { mount(1, 0); }
     }
 }