Преглед изворни кода

add windscreen code to render upper and lower windscreen frames, add thread cover, lower facets for rendering helixes to use less memory, move some parameters to the windscreen file

Fernando Pablo Lopez-Lezcano пре 9 година
родитељ
комит
4df9474e70
1 измењених фајлова са 184 додато и 20 уклоњено
  1. 184 20
      SpHEAR_windscreen.scad

+ 184 - 20
SpHEAR_windscreen.scad

@@ -23,17 +23,35 @@
 //   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>
+
 // http://dkprojects.net/openscad-threads/
 // used for the windscreeen mount threads
 include <threads.scad>;
 
+// default number of facets for rendering
+facets = 128;
+
 ////
 //// default model parameters
 ////
 
+// number of helixes of windscreen frame
+windscreen_sides = 12;
+
+// radius of windscreen beams
+windscreen_beam_radius = 1.3;
+
+// radius of frame connectors
+windscreen_conn_radius = windscreen_beam_radius + 0.8;
+
+// height of connector pin
+windscreen_pin_height = 4.0;
+
+
 // windscreen frame
 
-module sphear_windscreen_frame(sides, radius, height, beam_radius, twist, heights) {
+module sphear_windscreen_frame(sides, height, radius, beam_radius, twist) {
     inc = 360/sides;
     for (r = [0:inc:360]) for (t = [1, -1]) rotate([0, 0, r]) {
         render() {
@@ -42,25 +60,13 @@ module sphear_windscreen_frame(sides, radius, height, beam_radius, twist, height
                     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) {
+module sphear_windscreen_inset_frame(sides, height, radius, iradius, 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]) {
@@ -127,7 +133,7 @@ module sphear_windscreen_dome(sides, radius, beam_radius) {
     }
 }
 
-// windscreen mount to body with thread
+// octagonal windscreen mount to body with thread
 
 module sphear_windscreen_mount(height, radius, beam_radius) {
     octagon_radius = (radius + 2 * beam_radius + wall) * cos(PI/8);
@@ -151,24 +157,182 @@ module sphear_windscreen_mount(height, radius, beam_radius) {
 
 // round windscreen mount to body with thread
 
-module sphear_windscreen_round_mount(height, radius, wall) {
+module sphear_windscreen_round_mount(height, radius, wradius, 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
+    // outer ring that attaches to windscreen
     difference() {
         union() {
-            cylinder(r = radius + 2 * wall, h = height/2, $fn = facets);
+            cylinder(r = wradius, h = height/2, $fn = facets);
             translate([0, 0, height/2]) {
-                cylinder(r1 = radius + 2 * wall, r2 = radius + wall, h = height/2, $fn = facets);
+                cylinder(r1 = wradius, 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]) {
+    translate([-(wradius), 0, 0]) {
         cylinder(r = 1.0, h = height/2, $fn = facets);
     }
 }
+
+// round windscreen thread cover
+
+module sphear_windscreen_thread_cover(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);
+    }
+    // smooth transition to flare
+    *translate([0, 0, height/2]) {
+        difference() {
+            translate([0, 0, height/2]) {
+                cylinder(r2 = radius - windscreen_thread_depth/2, r1 = radius + wall, h = height/3, $fn = facets);
+            }
+            cylinder(r2 = radius - windscreen_thread_depth, r1 = radius, h = height, $fn = facets);
+        }
+    }
+}
+
+// upper windscreen frame
+
+module sphear_upper_windscreen(sides, height, radius, beam_radius, conn_radius, pin_height, connectors = true) {
+    ang = 360 / sides;
+    // dome at top
+    translate([0, 0, height]) {
+        sphear_windscreen_dome(sides, radius, beam_radius);
+    }
+    // spiral wireframe
+    translate([0, 0, 2]) {
+        difference() {
+            sphear_windscreen_frame(sides, height, radius, beam_radius, 45);
+            if (connectors) {
+                // remove bottom of beams to make space for the connectors
+                for (r = [1:360/sides:360]) rotate([0, 0, r]) {
+                    translate([radius, -beam_radius/2, 0]) {
+                        cylinder(r = conn_radius, h = pin_height - 1.0, $fn = facets);
+                    }
+                }
+            }
+        }
+    }
+    if (connectors) {
+        // connectors to lower frame
+        for (r = [1:360/sides:360]) rotate([0, 0, r]) {
+            translate([radius, -beam_radius/2, 0]) {
+                difference() {
+                    union() {
+                        cylinder(r = conn_radius, h = pin_height + 1.0, $fn = facets);
+                        translate([0, 0, pin_height + 1]) {
+                            sphere(r = conn_radius, $fn = facets);
+                        }
+                    }
+                    cylinder(r = beam_radius + fit, h = pin_height + 0.5, $fn = facets);
+                }
+            }
+        }
+        // bottom ring, prevents connectors to lower frame from toppling when printing
+         difference() {
+            scale([1.0, 1.0, 1.5]) rotate_extrude(convexity = 10, $fn = facets/2) {
+                translate([radius, 0, 0]) {
+                    circle(r = wall, $fn = facets/2);
+                }
+            }
+            translate([0, 0, -2 * wall]) {
+                cylinder(r = radius + wall, h = 2 * wall + thin_mint, $fn = facets/2);
+            }
+            for (r = [1:360/sides:360]) rotate([0, 0, r]) {
+                translate([radius, -beam_radius/2, -2]) {
+                        cylinder(r = conn_radius - thin_mint, h = 6.0 + thin_mint, $fn = facets/2);
+                }
+            }
+        }
+    }
+    // crossing reinforcements
+    // first mid crossing
+    translate([0, 0, height/3 + 2.0]) {
+        sphear_windscreen_frame_reinforcements(sides, radius, beam_radius, ang/2, 0);
+    }
+    // second mid crossing
+    translate([0, 0, height*2/3 + 2.0]) {
+        sphear_windscreen_frame_reinforcements(sides, radius, beam_radius, 0, 0);
+    }
+    // to dome
+    translate([0, 0, height + 2.0]) {
+        sphear_windscreen_frame_reinforcements(sides, radius, beam_radius, ang/2, 0);
+    }
+}
+
+// lower windscreen frame
+
+module sphear_lower_windscreen(sides, height, radius, beam_radius, conn_radius, pin_height, connectors = true) {
+    ang = 360 / sides;
+    // frame
+    rotate([0, 0, ang/2]) {
+        sphear_windscreen_frame(sides, height, radius, beam_radius, 45);
+    }
+    // frame crossing reinforcements
+    rotate([0, 0, ang/2]) {
+        // first mid crossing
+        translate([0, 0, height/3]) {
+            sphear_windscreen_frame_reinforcements(sides, radius, beam_radius, ang/2, 0);
+        }
+        // second mid crossing
+        translate([0, 0, height*2/3]) {
+            sphear_windscreen_frame_reinforcements(sides, radius, beam_radius, 0, 0);
+        }
+    }
+    // connector to upper frame
+    for (r = [1:ang:360]) rotate([0, 0, r]) {
+        translate([radius, -beam_radius/2, height - 1.0 + 0.4]) {
+            render() {
+                difference() {
+                    sphere(r = conn_radius, $fn = facets);
+                    translate([-2 * conn_radius, -2 * conn_radius, (beam_radius) / 2]) {
+                        cube([4 * conn_radius, 4 * conn_radius, 4 * conn_radius]);
+                    }
+                }
+                // pin
+                cylinder(r = beam_radius - fit, h = pin_height, $fn = facets);
+            }
+        }
+    }
+    // mount to body
+    rotate([0, 0, 90]) {
+        sphear_windscreen_round_mount(windscreen_thread_height, windscreen_thread_radius, windscreen_radius, 2 * wall);
+    }
+}
+
+//
+// Render components
+//
+
+// upper windscreen
+
+module render_sphear_upper_windscreen(zoffset) {
+    translate([0, 0, zoffset]) {
+        sphear_upper_windscreen(windscreen_sides, windscreen_height, windscreen_radius,
+            windscreen_beam_radius, windscreen_conn_radius, windscreen_pin_height, connectors = true);
+    }
+}
+
+// lower windscreen
+
+module render_sphear_lower_windscreen(zoffset) {
+    translate([0, 0, zoffset]) {
+        sphear_lower_windscreen(windscreen_sides, windscreen_height, windscreen_radius,
+            windscreen_beam_radius, windscreen_conn_radius, windscreen_pin_height, connectors = true);
+    }
+}
+
+// windscreen thread cover
+
+module render_sphear_windscreen_thread_cover(zoffset) {
+    translate([0, 0, zoffset]) {
+        sphear_windscreen_thread_cover(windscreen_thread_height, windscreen_thread_radius, wall);
+    }
+}