]> www.fi.muni.cz Git - things.git/blob - firefly-q6-case.scad
smaller baseplate, higher horn
[things.git] / firefly-q6-case.scad
1 infty = 200;
2 eps = 0.01;
3
4 wall = 1;
5
6 body_l = 70 + 0.7;
7 body_w = 33 + 0.7;
8 body_h = 28 + 0.7;
9 corner_r = 8;
10 corner_side_h = 12;
11
12 hook_w = 4;
13 hook_l = 6.5;
14 hook_hole_l = 4;
15 hook_hole_w = 2.5;
16 hook_h = 3;
17
18 hook_center_hole = 15;
19
20 bottom_hole_l = body_l - 2*corner_r - 2*hook_l;
21 bottom_hole_w = body_w - 4*wall;
22
23 side_hole_l1 = body_l - 4*corner_r;
24 side_hole_l2 = body_l - corner_r;
25 side_hole_bot = 2*wall;
26
27 lens_d = 23;
28 lens_hole_l = 4;
29 lens_zoff = 8;
30
31
32 difference() {
33         // outer body
34         hull() {
35                 for (x = [-1, 1]) for (y = [-1, 1]) scale([x, y, 1])
36                         translate([body_l/2 - corner_r,
37                                 body_w/2 - corner_r, 0])
38                         cylinder(r = corner_r + wall, h = corner_side_h + wall);
39         }
40         // hole for the camera body
41         hull() {
42                 for (x = [-1, 1]) for (y = [-1, 1]) scale([x, y, 1])
43                         translate([body_l/2 - corner_r,
44                                 body_w/2 - corner_r, wall])
45                         cylinder(r = corner_r, h = body_h);
46         }
47         // hole in the bottom
48         translate([-bottom_hole_l/2, -bottom_hole_w/2, -eps])
49                 cube([bottom_hole_l, bottom_hole_w, body_h]);
50         // side hole
51         hull() {
52                 translate([-side_hole_l1/2, -body_w/2-wall-eps, side_hole_bot+wall])
53                         cube([side_hole_l1, body_w+2*wall+2*eps, wall]);
54                 translate([-side_hole_l2/2, -body_w/2-wall-eps, corner_side_h+wall])
55                         cube([side_hole_l2, body_w+2*wall+2*eps, wall]);
56         }
57         // lens holes
58         for (x = [-1, 1]) scale([x, 1, 1]) {
59                 translate([body_l/2-lens_hole_l, 0, lens_zoff + wall])
60                         rotate([0, 90, 0])
61                         cylinder(r = lens_d/2, h = lens_hole_l + wall + eps);
62                 translate([body_l/2-lens_hole_l, -lens_d/2, lens_zoff + wall])
63                         cube([lens_hole_l + wall + eps, lens_d, lens_d/2]);
64         }
65 }
66
67 // rubber band side hooks
68 for (x = [-1, 1]) for (y = [-1, 1]) scale([x, y, 1])
69         difference() {
70                 translate([body_l/2 - corner_r - hook_l,
71                         body_w/2, 0])
72                         cube([hook_l, hook_w + wall, hook_h]);
73                 translate([body_l/2 - corner_r - hook_hole_l,
74                         body_w/2 + wall, -eps])
75                         cube([hook_hole_l + eps, hook_hole_w, hook_h+2*eps]);
76         }
77
78 // center hooks
79 for (y = [-1, 1]) scale([1, y, 1])
80         difference() {
81                 translate([-hook_center_hole/2-hook_l, body_w/2, 0])
82                         cube([2*hook_l+hook_center_hole, hook_w + wall, hook_h]);
83                 translate([-hook_center_hole/2, body_w/2 + wall, -eps])
84                         cube([hook_center_hole, hook_hole_w, hook_h+2*eps]);
85                 for (x = [-1, 1]) scale([x, 1, 1])
86                         translate([hook_center_hole/2+hook_l - hook_hole_l,
87                                 body_w/2 + wall, -eps])
88                                 cube([hook_hole_l + eps, hook_hole_w, hook_h+2*eps]);
89         }
90
91 if (0) {
92 // base plate
93 difference() {
94         hull() {
95                 for (x = [-1, 1]) for (y = [-1, 1]) scale([x, y, 1])
96                         translate([body_l/2 - corner_r,
97                                 body_w/2 - corner_r, 0])
98                         cylinder(r = corner_r + wall, h = wall);
99         }
100         // translate([-body_l/2+corner_r + hook_l, -body_w/2+corner_r, -eps])
101         //      cube([body_l-2*corner_r-2*hook_l, body_w - 2*corner_r, wall +2*eps]);
102         translate([-body_l/2+corner_r, -body_w/2+corner_r, -eps])
103                 cube([body_l-2*corner_r, body_w - 2*corner_r, wall +2*eps]);
104
105         // more space for lens
106         for (x = [-1, 1]) scale([x, 1, 1])
107                 translate([body_l/2, -body_w/2+corner_r, -eps])
108                         cube([wall+eps, body_w-2*corner_r, wall+2*eps]);
109 }
110
111 // raised corner bottom
112 for (x = [-1, 1]) for (y = [-1, 1]) scale([x, y, 1])
113         translate([body_l/2 - corner_r,
114                 body_w/2 - corner_r, wall-eps])
115         difference() {
116                 cylinder(r = corner_r + wall, h = wall+eps);
117                 translate([-infty, -infty/2, -infty/2]) cube(infty);
118                 translate([-infty/2, -infty, -infty/2]) cube(infty);
119         }
120
121
122 // raised corner side
123 for (x = [-1, 1]) for (y = [-1, 1]) scale([x, y, 1])
124         translate([body_l/2 - corner_r,
125                 body_w/2 - corner_r, 2*wall-eps])
126         difference() {
127                 cylinder(r = corner_r + wall, h = corner_side_h+eps);
128                 translate([0, 0,-eps])
129                         cylinder(r = corner_r, h = infty);
130                 translate([-infty, -infty/2, -infty/2]) cube(infty);
131                 // front edges cut
132                 rotate([-30, 0, 0])
133                 translate([-infty/2, -infty, -infty/2]) cube(infty);
134         }
135 }
136