Pārlūkot izejas kodu

change octathingy body code to be simpler and correct

Fernando Pablo Lopez-Lezcano 9 gadi atpakaļ
vecāks
revīzija
941a88c195
1 mainītis faili ar 63 papildinājumiem un 64 dzēšanām
  1. 63 64
      Octathingy_mount_pcb.scad

+ 63 - 64
Octathingy_mount_pcb.scad

@@ -100,8 +100,8 @@ stalk_height = 60;
 wall = 1.0;
 
 // back and front clearance of pcb (components and leads)
-pcb_front = 13.25;
-pcb_back = 1.75;
+pcb_front = 3.00;
+pcb_back = 1.80;
 
 // calculated minimum "radius" of microphone box
 box_radius = pcb_front + (pcb_thickness + pcb_tfit) + pcb_back + 2 * wall;
@@ -192,31 +192,45 @@ module octa_pcb_clear(length, width, thick, slot_depth, front, back) {
 
 // the main body that holds the phantom power interfaces
 
-module one_pcb(pcb_w, pcb_l, pcb_t, slot, clear, back) {
-    // printed circuit board
-    translate([-pcb_t/2, -pcb_w/2, 0]) {
-        cube([pcb_t, pcb_w, pcb_l]);
-    }
-    // clear space in front of pcb
-    translate([0, -pcb_w/2+slot, 0]) {
-        cube([clear, pcb_w - (2 * slot), pcb_l]);
-    }
-    // clear space in back of pcb (to clear solder joints)
-    translate([-(back + pcb_t/2), -pcb_w/2+slot, 0]) {
-        cube([back, pcb_w - (2 * slot), pcb_l]);
-    }
-}
-
-module one_pcb_spar(pcb_w, pcb_l, pcb_t, slot, back) {
-    translate([-(back + pcb_t/2 + 2 * wall), -(pcb_w/2 + slot), 0]) {
-        cube([back, pcb_w + (2 * slot), pcb_l]);
+module one_pcb_slot (pcb_w, pcb_l, pcb_t, slot_d, front, back, test = false) {
+    d = pcb_t + front + back;
+    render() translate([-(pcb_w/2 + wall/2), -back, 0]) {
+        // make cage with slots for pcb
+        difference() {
+            translate([-2 * wall, 0, 0]) {
+                cube([pcb_w + 4 * wall, d, pcb_l]);
+            }
+            translate([slot_d, 0, 0]) {
+                cube([pcb_w - 2 * slot_d, pcb_t + front + back, pcb_l]);
+            }
+            translate([0, back, 0]) {
+                cube([pcb_w, pcb_t, pcb_l]);
+            }
+            // make top and bottom entry channels
+            translate([slot_d, back + pcb_t/2, 0]) {
+                rotate([0, 0, 45]) cylinder(r1 = pcb_t * 1.1, r2 = 0, h = 8.0, $fn = 4);
+            }
+            translate([pcb_w - slot_d, back + pcb_t/2, 0]) {
+                rotate([0, 0, 45]) cylinder(r1 = pcb_t * 1.1, r2 = 0, h = 8.0, $fn = 4);
+            }
+            translate([slot_d, back + pcb_t/2, pcb_l - 8.0]) {
+                rotate([0, 0, 45]) cylinder(r2 = pcb_t * 1.1, r1 = 0, h = 8.0, $fn = 4);
+            }
+            translate([pcb_w - slot_d, back + pcb_t/2, pcb_l - 8.0]) {
+                rotate([0, 0, 45]) cylinder(r2 = pcb_t * 1.1, r1 = 0, h = 8.0, $fn = 4);
+            }
+        }
+        // add spar in the back
+        translate([-2 * wall, -back + wall, 0]) {
+            cube([pcb_w + 4 * wall, wall, pcb_l]);
+        }
     }
-}
-
-module one_capacitor(pcb_w, pcb_l, pcb_t) {
-    cap_diam = 10.2;
-    translate([-pcb_t + cap_diam/2, -pcb_w/2, 0]) {
-        cylinder(r = (cap_diam/2), h = 20, $fn = facets);
+    // add capacitor if in test mode
+    if (test) {
+        cap_diam = 10.2;
+        translate([0, cap_diam/2 + pcb_t, 0]) {
+            cylinder(r = cap_diam/2, h = 20, $fn = facets);
+        }
     }
 }
 
@@ -235,31 +249,33 @@ module rounded_octagon_wall(height, radius, wall) {
 }
 
 render_screw_holes = true;
-radial_pcb_offset = 17;
+radial_pcb_offset = 17.0;
 
 module octa_mount_body(height, radius, lower_lip, upper_lip, clear) {
     // rotate pcb assembly so it does not interfere with the screws
-    offset_angle = -18;
+    offset_angle = -16;
     // rotate individual pcb's to better use the internal space of the body
-    twist_angle = 18;
+    twist_angle = 16;
     difference() {
         union() {
             difference() {
-                // main body
-                rounded_octagon(height, radius);
-                // remove pcb slots
-                for (r = [0:360/8:360]) rotate([0, 0, r + offset_angle]) {
-                    translate([0, radial_pcb_offset, 0]) {
-                        rotate([0, 0, twist_angle]) one_pcb(pcb_width, pcb_length, pcb_thickness, pcb_slot_depth, 5, pcb_back);
+                union() {
+                    // main body
+                    rounded_octagon_wall(height, radius, 2 * wall);
+                    // slots for printed circuit boards
+                    intersection() {
+                        for (r = [0:360/8:360]) rotate([0, 0, r + offset_angle]) {
+                            translate([radial_pcb_offset, 0, 0]) {
+                                rotate([0, 0, 180 + twist_angle]) {
+                                    one_pcb_slot(pcb_width + pcb_fit, height * 2/3, pcb_thickness + pcb_tfit, 
+                                        pcb_slot_depth, pcb_front, pcb_back, false);
+                                }
+                            }
+                        }
+                        // clip outside
+                        rounded_octagon(height, radius);
                     }
                 }
-                // remove inner tube
-                rotate([0, 0, 0]) difference() {
-                    cylinder(r = radial_pcb_offset + pcb_width/2 - wall, h = pcb_length, $fn = facets);
-                    cylinder(r = radial_pcb_offset - pcb_width/2 + 3 * wall, h = pcb_length, $fn = 8);
-                }
-                // remove inner cylinder
-                rotate([0, 0, 0]) cylinder(r = radial_pcb_offset - pcb_width/2 - wall, h = pcb_length, $fn = 8);
                 // upper lip for flare to microphone
                 translate([0, 0, height - upper_lip]) {
                     rounded_octagon_wall(upper_lip, radius, wall + lip_fit);
@@ -268,21 +284,17 @@ module octa_mount_body(height, radius, lower_lip, upper_lip, clear) {
                 translate([0, 0, 0]) {
                     rounded_octagon_wall(upper_lip, radius, wall + lip_fit);
                 }
-                // remove upper portion of pcb slots
-                translate([0, 0, height * 2/3]) {
-                    rounded_octagon(height * 2/3, radius - 2.5 * wall);
-                }
             }
             if (render_screw_holes) {
                 // add backplates for upper lip screws
                 for (r = [45, 135, 225, 315]) {
-                    rotate([0, 0, r]) translate([-(radius - 3 * wall), -2, height * 2/3]) {
-                        cube([2, 4, height * 1/3]);
+                    rotate([0, 0, r]) translate([-(radius - 3 * wall), -2.5, 0]) {
+                        cube([2, 5, height]);
                     }
                 }
-             }
-         }
-         if (render_screw_holes) {
+            }
+        }
+        if (render_screw_holes) {
             // make eight holes in the the body for screws that hold both flares
             // (number 0 size, 1/4" long = thread diameter: 1.6mm, head diameter: 2.75)
             difference() {
@@ -299,19 +311,6 @@ module octa_mount_body(height, radius, lower_lip, upper_lip, clear) {
             }
         }
     }
-    // add spars that connect internal hub to outer ring
-    for (r = [0:360/8:360]) rotate([0, 0, r + offset_angle]) {
-        translate([0, radial_pcb_offset + pcb_slot_depth, 0]) {
-            rotate([0, 0, twist_angle]) one_pcb_spar(pcb_width, height * 2/3, pcb_thickness, pcb_slot_depth, wall);
-        }
-    }
-    // test for capacitor fit
-    // electrolytic capacitors
-    *for (r = [0:360/8:360]) rotate([0, 0, r + offset_angle]) {
-        translate([0, radial_pcb_offset + pcb_width/2, 0]) {
-            rotate([0, 0, twist_angle]) one_capacitor(pcb_width, pcb_length, pcb_thickness);
-        }
-    }
 }
 
 // the main body of the microphone mount (old rectangular design)