فهرست منبع

move shared modules to SpHEAR_common, remove from TinySpHEAR and Octathingy mount_pcb files, change the names of some modules for readability

Fernando Pablo Lopez-Lezcano 10 سال پیش
والد
کامیت
f4fd8cceda
3فایلهای تغییر یافته به همراه109 افزوده شده و 158 حذف شده
  1. 30 94
      Octathingy_mount_pcb.scad
  2. 58 0
      SpHEAR_common.scad
  3. 21 64
      TinySpHEAR_mount_pcb.scad

+ 30 - 94
Octathingy_mount_pcb.scad

@@ -28,7 +28,6 @@
 //   Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)
 // http://creativecommons.org/licenses/by-nc-sa/4.0/
 
-include <SpHEAR_common.scad>;
 include <Octathingy_common.scad>;
 include <CCRMA_logo.scad>;
 
@@ -124,30 +123,6 @@ internal_ring_gap = 1.0;
 connector_w = 10.0;
 connector_d = 2.0;
 
-// the printed circuit board
-
-module pcb(length, width, thick) {
-    translate([-width/2, 0, 0]) {
-        cube([width, thick, length]);
-    }
-}
-
-// the printed circuit board plus space in the front and back for components
-
-module pcb_clear(length, width, thick, slot_depth, front, back) {
-    translate([0, - (thick + front)]) {
-        pcb(length, width, thick);
-        // clear space in the front
-        translate([- (width/2 - slot_depth), thick, 0]) {
-            cube([width - 2 * slot_depth, front, length]);
-        }
-        // clear space in the back
-        translate([- (width/2 - slot_depth), - back, 0]) {
-            cube([width - 2 * slot_depth, back, length]);
-        }    
-    }
-}
-
 // all eight printed circuit boards
 
 module octa_pcb_clear(length, width, thick, slot_depth, front, back) {
@@ -162,64 +137,25 @@ module octa_pcb_clear(length, width, thick, slot_depth, front, back) {
     }
 }
 
-// box with rounded corners
-
-module solid_round_box(height, width, depth, radius) {
-    dw = width - radius;
-    dd = depth - radius;
-    minkowski() {
-        translate([-dw, -dd, 0]) {
-            cube([dw * 2, dd * 2, height / 2]);
-        }
-        cylinder(r = radius, h = height / 2, $fn = facets);
-    }
-}
-
-module round_box(height, width, depth, radius, wall) {
-    iradius = radius * ((width - wall) / width);
-    difference() {
-        solid_round_box(height, width, depth, radius);
-        solid_round_box(height, width - wall, depth - wall, iradius);
-    }
-}
-
-module octa_mount_box(height, xr, yr, corner) {
-    xrd = xr - corner;
-    yrd = yr - corner;
-    minkowski() {
-        translate([-xrd, -yrd, 0]) {
-            cube([xrd * 2, yrd * 2, height / 2]);
-        }
-        cylinder(r = corner, h = height / 2, $fn = facets);
-    }
-}
-
-// inset box with rounded corners
-
-module octa_mount_box_relative(height, ref_xradius, ref_yradius, ref_corner, radius_inc) {
-    corner = ref_corner * ((ref_xradius + radius_inc) / ref_xradius);
-    octa_mount_box(height, ref_xradius + radius_inc, ref_yradius + radius_inc, corner);
-}
-
 // the main body of the microphone mount
 
 module octa_mount_body(height, width, depth, radius, lower_lip, upper_lip, clear) {
     // outer shell
     difference() {
-        round_box(height, width, depth, radius, 2 * wall);
+        rounded_box(height, width, depth, radius, 2 * wall);
         // upper lip for flare to microphone
         translate([0, 0, height - upper_lip]) {
-            round_box(upper_lip, width, depth, radius, wall + lip_fit);
+            rounded_box(upper_lip, width, depth, radius, wall + lip_fit);
+        }
+        // lower lip for flare to cable
+        translate([0, 0, 0]) {
+            rounded_box(upper_lip, width, depth, radius, wall + lip_fit);
         }
-            // lower lip for flare to cable
-            translate([0, 0, 0]) {
-                round_box(upper_lip, width, depth, radius, wall + lip_fit);
-            }
     }
     // mounting slots for pcb's
     slot_len = 30;
     difference() {
-        solid_round_box(slot_len, width - wall - lip_fit, depth - wall - lip_fit, radius);
+        rounded_block(slot_len, width - wall - lip_fit, depth - wall - lip_fit, radius);
         union() {
             // hollow out the inside with slots for pcbs
             octa_pcb_clear(slot_len, pcb_width, pcb_thickness, pcb_slot_depth, pcb_front, pcb_back);
@@ -268,22 +204,22 @@ module octa_mount_body(height, width, depth, radius, lower_lip, upper_lip, clear
 module octa_mount_flare(height, lip, transition, xradius, yradius, corner, top_radius, stalk_height, dot) {
     // bottom rounded box
     difference() {
-        octa_mount_box(height, xradius, yradius, corner);
-        octa_mount_box_relative(height, xradius, yradius, corner, -(2 * wall));
+        rounded_block(height, xradius, yradius, corner);
+        rounded_block_relative(height, xradius, yradius, corner, -(2 * wall));
         // flange to mount on body
-        octa_mount_box_relative(lip + 1.00, xradius, yradius, corner, - (wall));
+        rounded_block_relative(lip + 1.00, xradius, yradius, corner, - (wall));
     }
     // flare to round section
     translate([0, 0, height]) {
         difference() {
             hull() {
-                octa_mount_box(1, xradius, yradius, corner);
+                rounded_block(1, xradius, yradius, corner);
                 translate([0, 0, transition]) {
                     cylinder(r = top_radius, h = 1, $fn = facets);
                 }
             }
             hull() {
-                octa_mount_box_relative(1, xradius, yradius, corner, - 2 * wall);
+                rounded_block_relative(1, xradius, yradius, corner, - 2 * wall);
                 translate([0, 0, transition]) {
                     cylinder(r = top_radius - wall, h = 1, $fn = facets);
                 }
@@ -315,28 +251,28 @@ module octa_mount_flare(height, lip, transition, xradius, yradius, corner, top_r
 // flares from the body to a dual cable housing
 
 module octa_mount_flare_dual(height, lip, transition, xradius, yradius, corner, top_radius, stalk_height) {
-    // hack to get it to render, fix problem in octa_mount_box when radius is equal to corner...
+    // hack to get it to render, fix problem in rounded_block when radius is equal to corner...
     delta = 0.001;
     // bottom rounded box
     difference() {
-        octa_mount_box(height, xradius, yradius, corner);
-        octa_mount_box_relative(height, xradius, yradius, corner, -(2 * wall));
+        rounded_block(height, xradius, yradius, corner);
+        rounded_block_relative(height, xradius, yradius, corner, -(2 * wall));
         // flange to mount on body
-        octa_mount_box_relative(lip + 1.00, xradius, yradius, corner, - (wall));
+        rounded_block_relative(lip + 1.00, xradius, yradius, corner, - (wall));
     }
     // flare to rounded section section
     translate([0, 0, height]) {
         difference() {
             hull() {
-                octa_mount_box(0.01, xradius, yradius, corner);
+                rounded_block(0.01, xradius, yradius, corner);
                 translate([0, 0, transition]) {
-                    octa_mount_box(0.01, top_radius, top_radius * 2, top_radius - delta);
+                    rounded_block(0.01, top_radius, top_radius * 2, top_radius - delta);
                 }
             }
             hull() {
-                octa_mount_box_relative(0.01, xradius, yradius, corner, - 2 * wall);
+                rounded_block_relative(0.01, xradius, yradius, corner, - 2 * wall);
                 translate([0, 0, transition]) {
-                    octa_mount_box(0.01, top_radius - wall, (top_radius * 2) - 1.5 * wall, top_radius - wall - delta);
+                    rounded_block(0.01, top_radius - wall, (top_radius * 2) - 1.5 * wall, top_radius - wall - delta);
                 }
             }
         }
@@ -344,7 +280,7 @@ module octa_mount_flare_dual(height, lip, transition, xradius, yradius, corner,
     // corner box cable stalk
     translate([0, 0, height + transition]) {
         difference() {
-            octa_mount_box(stalk_height, top_radius, top_radius * 2, top_radius - delta);
+            rounded_block(stalk_height, top_radius, top_radius * 2, top_radius - delta);
             // add holes for two cables
             for (offset = [top_radius - wall/2, -(top_radius  - wall/2)]) {
                 translate([0, offset, 0]){
@@ -400,7 +336,7 @@ module octa_capsule_array_mount(angles) {
 
 // internal ring of shock mount
 
-module tetra_shock_mount_internal_ring(height, radius, corner, gap, lip) {
+module octa_shock_mount_internal_ring(height, radius, corner, gap, lip) {
     slot_sep = radius * 2 / 2.5;
     slot_w = 5;
     slot_o = height / 3;
@@ -408,13 +344,13 @@ module tetra_shock_mount_internal_ring(height, radius, corner, gap, lip) {
         union() {
             // base ring
             difference() {
-                tetra_mount_box_relative(slot_o, radius + gap, corner, 3 * wall);
-                tetra_mount_box(slot_o, radius + gap, corner);
+                tetra_rounded_mount_box_relative(slot_o, radius + gap, corner, 3 * wall);
+                tetra_rounded_mount_box(slot_o, radius + gap, corner);
             }
             // upper ring with slots for rubber bands
             difference() {
-                tetra_mount_box_relative(height, radius + gap + 2 * wall, corner, 2 * wall);
-                tetra_mount_box_relative(height, radius + gap + wall, corner, 1 * wall);
+                tetra_rounded_mount_box_relative(height, radius + gap + 2 * wall, corner, 2 * wall);
+                tetra_rounded_mount_box_relative(height, radius + gap + wall, corner, 1 * wall);
                 for (rot = [0, 90, 180, 270]) rotate([0, 0, rot]) {
                     // slots for rubber bands
                     minkr = 1.25;
@@ -488,8 +424,8 @@ module tetra_shock_mount_ring(outside_radius, inside_radius, thickness) {
 
 module tetra_shock_mount_external_ring(height, radius, corner, gap, lip) {
     difference() {
-        tetra_mount_box_relative(6, radius, mount_corner, gap);
-        tetra_mount_box_relative(6, radius, mount_corner, gap - 4 * wall);
+        tetra_rounded_mount_box_relative(6, radius, mount_corner, gap);
+        tetra_rounded_mount_box_relative(6, radius, mount_corner, gap - 4 * wall);
     }
     for (rot = [0, 90, 180, 270]) {
         rotate([0, 0, rot]) {
@@ -505,8 +441,8 @@ module tetra_shock_mount_external_ring(height, radius, corner, gap, lip) {
     translate([0, 18, 0]) {
         intersection() {
             difference() {
-                tetra_mount_box_relative(6, radius, mount_corner - 5, gap);
-                tetra_mount_box_relative(6, radius, mount_corner - 5, gap - 4 * wall);
+                tetra_rounded_mount_box_relative(6, radius, mount_corner - 5, gap);
+                tetra_rounded_mount_box_relative(6, radius, mount_corner - 5, gap - 4 * wall);
             }
             translate([-(radius + 2 * mount_corner), 0, 0]) {
                 cube([2 * (radius + 2 * mount_corner), radius + 2 * mount_corner, 6]);

+ 58 - 0
SpHEAR_common.scad

@@ -226,3 +226,61 @@ module capsule (mounts, twist, ridge, ridge_wfit = 0.0, ridge_hfit = 0.0, solid
     }
 }
 
+//// shared modules for zapnspark printed circuit board
+
+// one printed circuit board
+
+module pcb(length, width, thick) {
+    translate([-width/2, 0, 0]) {
+        cube([width, thick, length]);
+    }
+}
+
+// one printed circuit board with space in the front and back for components
+
+module pcb_clear(length, width, thick, slot_depth, front, back) {
+    translate([0, - (thick + front)]) {
+        pcb(length, width, thick);
+        // clear space in the front
+        translate([- (width/2 - slot_depth), thick, 0]) {
+            cube([width - 2 * slot_depth, front, length]);
+        }
+        // clear space in the back
+        translate([- (width/2 - slot_depth), - back, 0]) {
+            cube([width - 2 * slot_depth, back, length]);
+        }
+    }
+}
+
+//// shared modules for mount
+
+// rectangular block with rounded corners
+
+module rounded_block(height, width, depth, radius) {
+    dw = width - radius;
+    dd = depth - radius;
+    minkowski() {
+        translate([-dw, -dd, 0]) {
+            cube([dw * 2, dd * 2, height / 2]);
+        }
+        cylinder(r = radius, h = height / 2, $fn = facets);
+    }
+}
+
+// rectangular inset block with rounded corners
+
+module rounded_block_relative(height, ref_width, ref_depth, ref_corner, radius_inc) {
+    corner = ref_corner * ((ref_width + radius_inc) / ref_width);
+    rounded_block(height, ref_width + radius_inc, ref_depth + radius_inc, corner);
+}
+
+// box with rounded corners
+
+module rounded_box(height, width, depth, radius, wall) {
+    iradius = radius * ((width - wall) / width);
+    difference() {
+        rounded_block(height, width, depth, radius);
+        rounded_block(height, width - wall, depth - wall, iradius);
+    }
+}
+

+ 21 - 64
TinySpHEAR_mount_pcb.scad

@@ -114,30 +114,6 @@ internal_ring_gap = 1.0;
 connector_w = 10.0;
 connector_d = 2.0;
 
-// the printed circuit board
-
-module pcb(length, width, thick) {
-    translate([-width/2, 0, 0]) {
-        cube([width, thick, length]);
-    }
-}
-
-// the printed circuit board plus space in the front and back for components
-
-module pcb_clear(length, width, thick, slot_depth, front, back) {
-    translate([0, - (thick + front)]) {
-        pcb(length, width, thick);
-        // clear space in the front
-        translate([- (width/2 - slot_depth), thick, 0]) {
-            cube([width - 2 * slot_depth, front, length]);
-        }
-        // clear space in the back
-        translate([- (width/2 - slot_depth), - back, 0]) {
-            cube([width - 2 * slot_depth, back, length]);
-        }    
-    }
-}
-
 // all four printed circuit boards
 
 module tetra_pcb_clear(length, width, thick, slot_depth, front, back) {
@@ -148,30 +124,11 @@ module tetra_pcb_clear(length, width, thick, slot_depth, front, back) {
     }
 }
 
-// box with rounded corners
-
-module tetra_mount_box(height, radius, corner) {
-    rd = radius - corner;
-    minkowski() {
-        translate([-rd, -rd, 0]) {
-            cube([rd * 2, rd * 2, height / 2]);
-        }
-        cylinder(r = corner, h = height / 2, $fn = facets);
-    }
-}
-
-// inset box with rounded corners
-
-module tetra_mount_box_relative(height, ref_radius, ref_corner, radius_inc) {
-    corner = ref_corner * ((ref_radius + radius_inc) / ref_radius);
-    tetra_mount_box(height, ref_radius + radius_inc, corner);
-}
-
 // the main body of the microphone mount
 
 module tetra_mount_body(height, radius, corner, lower_lip, upper_lip, clear) {
     difference() {
-        tetra_mount_box(height, radius, corner);
+        rounded_block(height, radius, radius, corner);
         union() {
             // hollow out the inside with slots for pcbs
             tetra_pcb_clear(pcb_length, pcb_width, pcb_thickness, pcb_slot_depth, pcb_front, pcb_back);
@@ -180,20 +137,20 @@ module tetra_mount_body(height, radius, corner, lower_lip, upper_lip, clear) {
             // remove slots from inside body
             slot_len = 30;
             translate([0, 0, slot_len]) {
-                    tetra_mount_box_relative(height, radius, corner, - (2 * wall));
+                    rounded_block_relative(height, radius, radius, corner, - (2 * wall));
             }
             // upper lip for flare to microphone
             translate([0, 0, height - upper_lip]) {
                 difference() {
-                    tetra_mount_box(upper_lip, radius, corner);
-                    tetra_mount_box_relative(upper_lip, radius, corner, -(wall + lip_fit));
+                    rounded_block(upper_lip, radius, radius, corner);
+                    rounded_block_relative(upper_lip, radius, radius, corner, -(wall + lip_fit));
                 }
             }
             // lower lip for flare to cable
             translate([0, 0, 0]) {
                 difference() {
-                    tetra_mount_box(lower_lip, radius, corner);
-                    tetra_mount_box_relative(lower_lip, radius, corner, -(wall + lip_fit));
+                    rounded_block(lower_lip, radius, radius, corner);
+                    rounded_block_relative(lower_lip, radius, radius, corner, -(wall + lip_fit));
                 }
             }
         }
@@ -235,29 +192,29 @@ module tetra_mount_body(height, radius, corner, lower_lip, upper_lip, clear) {
 module tetra_mount_flare(height, lip, transition, bot_radius, bot_corner, top_radius, stalk_height, dot) {
     // bottom rounded box
     difference() {
-        tetra_mount_box(height, bot_radius, bot_corner);
-        tetra_mount_box_relative(height, bot_radius, bot_corner, -(2 * wall));
+        rounded_block(height, bot_radius, bot_radius, bot_corner);
+        rounded_block_relative(height, bot_radius, bot_radius, bot_corner, -(2 * wall));
         // flange to mount on body
-        tetra_mount_box_relative(lip + 1.00, bot_radius, bot_corner, - (wall));
+        rounded_block_relative(lip + 1.00, bot_radius, bot_radius, bot_corner, - (wall));
         // make a stepped transition to avoid big overhang (a fillet would be best)
         translate([0, 0, lip + 1.0]) {
-            tetra_mount_box_relative(1/3, bot_radius, bot_corner, - wall * 1.333);
+            rounded_block_relative(1/3, bot_radius, bot_radius, bot_corner, - wall * 1.333);
         }
         translate([0, 0, lip + 1.333]) {
-            tetra_mount_box_relative(1/3, bot_radius, bot_corner, - wall * 1.666);
+            rounded_block_relative(1/3, bot_radius, bot_radius, bot_corner, - wall * 1.666);
         }
     }
     // flare to round section
     translate([0, 0, height]) {
         difference() {
             hull() {
-                tetra_mount_box(1, bot_radius, bot_corner);
+                rounded_block(1, bot_radius, bot_radius, bot_corner);
                 translate([0, 0, transition]) {
                     cylinder(r = top_radius, h = 1, $fn = facets);
                 }
             }
             hull() {
-                tetra_mount_box_relative(1, bot_radius, bot_corner, - 2 * wall);
+                rounded_block_relative(1, bot_radius, bot_radius, bot_corner, - 2 * wall);
                 translate([0, 0, transition]) {
                     cylinder(r = top_radius - wall, h = 1, $fn = facets);
                 }
@@ -325,13 +282,13 @@ module tetra_shock_mount_internal_ring(height, radius, corner, gap, lip) {
         union() {
             // base ring
             difference() {
-                tetra_mount_box_relative(slot_o, radius + gap, corner, 3 * wall);
-                tetra_mount_box(slot_o, radius + gap, corner);
+                rounded_block_relative(slot_o, radius + gap, radius + gap, corner, 3 * wall);
+                rounded_block(slot_o, radius + gap, radius + gap, corner);
             }
             // upper ring with slots for rubber bands
             difference() {
-                tetra_mount_box_relative(height, radius + gap + 2 * wall, corner, 2 * wall);
-                tetra_mount_box_relative(height, radius + gap + wall, corner, 1 * wall);
+                rounded_block_relative(height, radius + gap + 2 * wall, radius + gap + 2 * wall, corner, 2 * wall);
+                rounded_block_relative(height, radius + gap + wall, radius + gap + wall, corner, 1 * wall);
                 for (rot = [0, 90, 180, 270]) rotate([0, 0, rot]) {
                     // slots for rubber bands
                     minkr = 1.25;
@@ -405,8 +362,8 @@ module tetra_shock_mount_ring(outside_radius, inside_radius, thickness) {
 
 module tetra_shock_mount_external_ring(height, radius, corner, gap, lip) {
     difference() {
-        tetra_mount_box_relative(6, radius, mount_corner, gap);
-        tetra_mount_box_relative(6, radius, mount_corner, gap - 4 * wall);
+        rounded_block_relative(6, radius, radius, mount_corner, gap);
+        rounded_block_relative(6, radius, radius, mount_corner, gap - 4 * wall);
     }
     for (rot = [0, 90, 180, 270]) {
         rotate([0, 0, rot]) {
@@ -422,8 +379,8 @@ module tetra_shock_mount_external_ring(height, radius, corner, gap, lip) {
     translate([0, 18, 0]) {
         intersection() {
             difference() {
-                tetra_mount_box_relative(6, radius, mount_corner - 5, gap);
-                tetra_mount_box_relative(6, radius, mount_corner - 5, gap - 4 * wall);
+                rounded_block_relative(6, radius, radius, mount_corner - 5, gap);
+                rounded_block_relative(6, radius, radius, mount_corner - 5, gap - 4 * wall);
             }
             translate([-(radius + 2 * mount_corner), 0, 0]) {
                 cube([2 * (radius + 2 * mount_corner), radius + 2 * mount_corner, 6]);