]> www.fi.muni.cz Git - things.git/blob - nerf.scad
switch holder.scad
[things.git] / nerf.scad
1 eps = 0.01;
2 infty = 100;
3
4 wall = 1;
5 cyl_wall = 1.5;
6
7 lens_d = 41.5 - 1.5;
8 lens_side_l = 25;
9 rail_in = 13.5;
10 rail_ex = 18.6;
11 rail_thick = 3.6;
12 rail_depth = rail_thick + wall;
13 body_l = 55;
14 rail_in_l = 15;
15
16 beam_l = 7;
17 beam_w = 0.8;
18
19 $fn = 120;
20
21 difference() {
22         union() {
23                 difference() {
24                         union() {
25                                 // outer cylinder
26                                 cylinder(r = lens_d/2 + 2*cyl_wall, h = body_l);
27                                 // rail base
28                                 translate([-rail_ex/2-wall, -lens_d/2-rail_depth-2*wall, 0])
29                                         cube([rail_ex+2*wall, lens_d/2+rail_depth+2*wall, body_l]);
30                         }
31                         // inner cylinder
32                         translate([0, 0, -eps])
33                                 cylinder(r = lens_d/2 + wall, h = body_l+2*eps);
34                         // cut the top third of the cylinder
35                         translate([-infty/2, lens_d/2*sin(30) + wall, -eps])
36                                 cube(infty);
37                         difference() {
38                                 // rail_ex -wide hole
39                                 translate([-rail_ex/2, -lens_d/2-2*wall-rail_thick, -eps])
40                                         cube([rail_ex, rail_thick, body_l+2*eps]);
41                                 // beam
42                                 translate([-rail_ex/2-eps, -lens_d/2-2*wall-beam_w, rail_in_l-beam_l])
43                                         cube([rail_ex+2*eps, beam_w+eps, beam_l]);
44                         }
45                         // rail_ex -wide top
46                         translate([-rail_ex/2, -lens_d/2-2*wall-rail_depth-eps, rail_in_l])
47                                 cube([rail_ex, rail_depth, body_l+2*eps]);
48                         // rail-in wide hole
49                         translate([-rail_in/2, -lens_d/2-2*wall-rail_depth-eps, -eps])
50                                 cube([rail_in, rail_depth+eps, body_l+2*eps]);
51                 }
52                 // inside supports
53                 for (angle = [-27, 27, 120, 240]) rotate([0, 0, angle])
54                         translate([0, -lens_d/2-cyl_wall, -2*eps])
55                                 cylinder(r = cyl_wall, h = body_l + 4*eps);
56         }
57         // slanted cylinder cut
58         translate([-infty/2, cos(60)*lens_d/2, body_l+lens_side_l])
59                 rotate([0, 90, 0])
60                 scale([2, 1.2, 1])
61                 cylinder(r = body_l/2, h = infty);
62 }
63