]> www.fi.muni.cz Git - things.git/blob - led-torch.scad
switch holder.scad
[things.git] / led-torch.scad
1 infty = 200;
2 eps = 0.01;
3
4 wall = 1;
5
6 led_d = 10 + 0.5;
7 int_d = 19/cos(30);
8 barrier_h = 8;
9 body_l = 70 + barrier_h;
10
11 clip_l = 2;
12 clip_w = 1.2;
13 clip_dist = 3;
14
15 /*
16 // main cylinder
17 difference() {
18         cylinder(r = int_d/2 + wall/cos(30), $fn = 6, h = body_l);
19         translate([0, 0, wall])
20         cylinder(r = int_d/2, $fn = 6, h = body_l);
21         // hole for LED
22         translate([0, 0, -eps])
23                 cylinder(r = led_d/2, h = infty);
24 }
25
26 // battery front end stop
27 translate([0, 0, barrier_h-wall])
28 intersection() {
29         cylinder(r = int_d/2 + wall/(2*cos(30)), $fn = 6, h = wall);
30         for (angle = [0:360/3:360]) rotate ([0, 0, angle])
31                 translate([led_d/2+wall, -infty/2, -eps])
32                         cube(infty);
33 }
34
35 // rear end clip
36 for (angle = [0:60:360]) rotate([0, 0, angle])
37 translate([-clip_l/2, int_d*cos(30)/2+wall, body_l - clip_dist]) {
38         scale([1, 1, 3])
39         rotate([0, 90, 0])
40                 cylinder(r = clip_w, h = clip_l, $fn = 4);
41 }
42
43 */
44
45 // lid
46
47 switch_w = 14;
48 switch_h = 9;
49
50 // tady je jen 1.5* misto 2x, at je to tesnejsi
51 lid_d = int_d + 2*wall/cos(30) + 1.5*clip_w/cos(30);
52 lid_h = clip_dist + 3*wall+3*clip_w + switch_h;
53
54 support_w = 4;
55 support_off = 3;
56 translate([0, int_d + 5, 0])
57 difference() {
58         cylinder(r = lid_d/2 + wall/cos(30), $fn = 6, h = lid_h);
59         translate([-switch_w/2, 0, wall+eps])
60                 cube([switch_w, infty, switch_h]);
61         difference() {
62                 union() {
63                         translate([0, 0, wall+switch_h])
64                                 cylinder(r = lid_d/2, $fn = 6, h = lid_h);
65                         translate([0, 0, wall])
66                                 cylinder(r = lid_d/2-2*wall/cos(30), $fn = 6, h = lid_h);
67                         intersection() { // switch side w/o support
68                                 translate([0, 0, wall])
69                                         cylinder(r = lid_d/2, $fn = 6, h = lid_h);
70                                 translate([-infty/2, 0, 0]) cube(infty);
71                         }
72                 }
73                 for (angle = [60:180:360]) rotate([0, 0, angle])
74                 translate([-clip_l/2, lid_d*cos(30)/2, switch_h+clip_dist + 2*wall]) {
75                         scale([1, 1, 3])
76                         rotate([0, 90, 0])
77                         cylinder(r = clip_w, h = clip_l, $fn = 4);
78                 }
79                 translate([-infty/2, -support_w-support_off, switch_h-eps])
80                         cube([infty, support_w, wall]);
81         }
82 }