Explorar o código

start moving windscreen components to a separate file

Fernando Pablo Lopez-Lezcano %!s(int64=9) %!d(string=hai) anos
pai
achega
961d7d3936
Modificáronse 1 ficheiros con 174 adicións e 0 borrados
  1. 174 0
      SpHEAR_windscreen.scad

+ 174 - 0
SpHEAR_windscreen.scad

@@ -0,0 +1,174 @@
+//
+// Spherical Harmonics Ear Project (*SpHEAR)
+//
+// Windscreen modules
+// 
+// Copyright 2017, Fernando Lopez-Lezcano, All Rights Reserved
+// nando@ccrma.stanford.edu
+//
+//  This program is free software: you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation, either version 3 of the License, or
+//  (at your option) any later version.
+//
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+//
+//  You should have received a copy of the GNU General Public License
+//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+// 3d Models released under the Creative Commons license as follows:
+//   Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)
+// http://creativecommons.org/licenses/by-nc-sa/4.0/
+
+// http://dkprojects.net/openscad-threads/
+// used for the windscreeen mount threads
+include <threads.scad>;
+
+////
+//// default model parameters
+////
+
+// windscreen frame
+
+module sphear_windscreen_frame(sides, radius, height, beam_radius, twist, heights) {
+    inc = 360/sides;
+    for (r = [0:inc:360]) for (t = [1, -1]) rotate([0, 0, r]) {
+        render() {
+            linear_extrude(height = height, center = false, convexity = 0, twist = twist * t, $fn = facets/2) {
+                translate([radius, 0, 0]) {
+                    circle(r = beam_radius, $fn = facets/2);
+                }
+            }
+            *if (t == -1) for (h = [1/3, 2/3, 1]) {
+                rotate([0, 0, (inc/2) * (t - 1)]) translate([radius, 0, h * height]) {
+                    intersection() {
+                        scale([1.0, 1.55, 1.0]) {
+                            translate([0, 0, -beam_radius * 2]) {
+                                cylinder(r = beam_radius, h = beam_radius * 4, $fn = facets);
+                            }
+                        }
+                        scale([1, 2, 2.5]) sphere(r = beam_radius, $fn = facets);
+                    }
+                }
+            }
+        }
+    }
+}
+
+// windscreen inset frame
+
+module sphear_windscreen_inset_frame(sides, radius, iradius, height, beam_radius, xscale = 1.0, yscale = 1.0) {
+    inc = 360/sides;
+    difference() {
+        for (r = [0:inc:360]) for (t = [1, -1]) rotate([0, 0, r]) {
+            render() {
+                hull() {
+                    translate([iradius, 0, 0]) {
+                        scale([xscale, yscale, 1.0]) cylinder(r = beam_radius, h = thin_mint, $fn = facets);
+                    }
+                    rotate([0, 0, inc/2 * t]) translate([radius, 0, height]) {
+                        cylinder(r = beam_radius, h = thin_mint, $fn = facets);
+                    }
+                }
+            }
+        }
+        cylinder(r = iradius, h = height, $fn = facets);
+    }
+}
+
+// windscreen frame reinforcements
+
+module sphear_windscreen_frame_reinforcements(sides, radius, beam_radius, zrotation, yrotation) {
+    for (r = [0:360/sides:360]) rotate([0, 0, r + zrotation]) {
+        translate([radius, 0, 0]) {
+            render() rotate([0, yrotation, 0]) intersection() {
+                scale([1.0, 1.55, 1.0]) {
+                    translate([0, 0, -beam_radius * 2]) {
+                        cylinder(r = beam_radius, h = beam_radius * 4, $fn = facets);
+                    }
+                }
+                scale([1, 2, 2.5]) sphere(r = beam_radius, $fn = facets);
+            }
+        }
+    }
+}
+
+// windscreen dome
+
+module sphear_windscreen_dome(sides, radius, beam_radius) {
+    arcs = sides/2 - 1;
+    ang = 360 / sides;
+    difference() {
+        for (r = [0, 90]) rotate([0, 0, r]) {
+            for (t = [1, -1]) {
+                translate([radius * sin(ang/2) * t, 0, 0]) rotate([0, 90, 0]) {
+                    render() rotate_extrude(convexity = 10, $fn = facets) {
+                        translate([radius * cos(ang/2), 0, 0]) {
+                            circle(r = beam_radius, $fn = facets);
+                        }
+                    }
+                }
+                translate([radius * sin(ang/(2/3)) * t, 0, 0]) rotate([0, 90, 0]) {
+                    render() rotate_extrude(convexity = 10, $fn = facets) {
+                        translate([radius * cos(ang/(2/3)), 0, 0]) {
+                            circle(r = beam_radius, $fn = facets);
+                        }
+                    }
+                }
+            }
+        }
+        brad = radius + 2 * beam_radius + thin_mint;
+        translate([-brad, -brad, - 2 * brad]) {
+            cube([2 * brad, 2 * brad, 2 * brad]);
+        }
+    }
+}
+
+// windscreen mount to body with thread
+
+module sphear_windscreen_mount(height, radius, beam_radius) {
+    octagon_radius = (radius + 2 * beam_radius + wall) * cos(PI/8);
+    difference() {
+        cylinder(r = radius + 2 * beam_radius + windscreen_thread_depth, h = height, $fn = facets);
+        metric_thread(diameter = radius * 2 + windscreen_thread_fit, pitch = windscreen_thread_pitch,
+                length = height, angle = windscreen_thread_angle, internal = true);
+        // make outside be a octagon instead of a circle
+        rotate([0, 0, 22.5]) translate([0, 0, -thin_mint]) {
+            difference() {
+                cylinder(r = 1.5 * radius, h = height + 2 * thin_mint);
+                cylinder(r = octagon_radius, h = height + 2 * thin_mint, $fn = 8);
+            }
+        }
+    }
+    // marker for center of screen
+    translate([-(radius + wall), 0, 0]) {
+        cylinder(r = 1.0, h = height, $fn = facets);
+    }
+}
+
+// round windscreen mount to body with thread
+
+module sphear_windscreen_round_mount(height, radius, wall) {
+    difference() {
+        cylinder(r = radius + wall, h = height, $fn = facets);
+        metric_thread(diameter = radius * 2 + windscreen_thread_fit, pitch = windscreen_thread_pitch,
+                length = height, angle = windscreen_thread_angle, internal = true);
+    }
+    // add better attachment points for windscreen
+    difference() {
+        union() {
+            cylinder(r = radius + 2 * wall, h = height/2, $fn = facets);
+            translate([0, 0, height/2]) {
+                cylinder(r1 = radius + 2 * wall, r2 = radius + wall, h = height/2, $fn = facets);
+            }
+        }
+        cylinder(r = radius + wall, h = height, $fn = facets);
+    }
+    // marker for center of microphone
+    translate([-(radius + 2 * wall), 0, 0]) {
+        cylinder(r = 1.0, h = height/2, $fn = facets);
+    }
+}