]> www.fi.muni.cz Git - things.git/commitdiff
nerf.scad: optics holder for nerf gun
authorJan "Yenya" Kasprzak <kas@fi.muni.cz>
Tue, 27 Nov 2018 16:29:55 +0000 (17:29 +0100)
committerJan "Yenya" Kasprzak <kas@fi.muni.cz>
Tue, 27 Nov 2018 16:29:55 +0000 (17:29 +0100)
nerf.scad [new file with mode: 0644]

diff --git a/nerf.scad b/nerf.scad
new file mode 100644 (file)
index 0000000..9bdddb7
--- /dev/null
+++ b/nerf.scad
@@ -0,0 +1,62 @@
+eps = 0.01;
+infty = 100;
+
+wall = 1;
+
+lens_d = 41.5;
+lens_side_l = 25;
+rail_in = 13.5;
+rail_ex = 18.2;
+rail_thick = 3.4;
+rail_depth = rail_thick + wall;
+body_l = 55;
+rail_in_l = 15;
+
+beam_l = 7;
+beam_w = 0.8;
+
+$fn = 120;
+
+difference() {
+       union() {
+               difference() {
+                       union() {
+                               // outer cylinder
+                               cylinder(r = lens_d/2 + 2*wall, h = body_l);
+                               // rail base
+                               translate([-rail_ex/2-wall, -lens_d/2-rail_depth-2*wall, 0])
+                                       cube([rail_ex+2*wall, lens_d/2+rail_depth+2*wall, body_l]);
+                       }
+                       // inner cylinder
+                       translate([0, 0, -eps])
+                               cylinder(r = lens_d/2 + wall, h = body_l+2*eps);
+                       // cut the top third of the cylinder
+                       translate([-infty/2, lens_d/2*sin(30) + wall, -eps])
+                               cube(infty);
+                       difference() {
+                               // rail_ex -wide hole
+                               translate([-rail_ex/2, -lens_d/2-2*wall-rail_thick, -eps])
+                                       cube([rail_ex, rail_thick, body_l+2*eps]);
+                               // beam
+                               translate([-rail_ex/2-eps, -lens_d/2-2*wall-beam_w, rail_in_l-beam_l])
+                                       cube([rail_ex+2*eps, beam_w+eps, beam_l]);
+                       }
+                       // rail_ex -wide top
+                       translate([-rail_ex/2, -lens_d/2-2*wall-rail_depth-eps, rail_in_l])
+                               cube([rail_ex, rail_depth, body_l+2*eps]);
+                       // rail-in wide hole
+                       translate([-rail_in/2, -lens_d/2-2*wall-rail_depth-eps, -eps])
+                               cube([rail_in, rail_depth+eps, body_l+2*eps]);
+               }
+               // inside supports
+               for (angle = [-27, 27, 120, 240]) rotate([0, 0, angle])
+                       translate([0, -lens_d/2-wall, -2*eps])
+                               cylinder(r = wall, h = body_l + 4*eps);
+       }
+       // slanted cylinder cut
+       translate([-infty/2, cos(60)*lens_d/2, body_l+lens_side_l])
+               rotate([0, 90, 0])
+               scale([2, 1.2, 1])
+               cylinder(r = body_l/2, h = infty);
+}
+