]> www.fi.muni.cz Git - things.git/blob - lampa-koupelna.scad
switch holder.scad
[things.git] / lampa-koupelna.scad
1 include <yenyalib.scad>
2
3 sirka 17.8
4 vyska 9.5
5
6 body_w = 15;
7 base_w = 30;
8 step1_h = 50;
9 step1_w = 20;
10 step1_off = 40;
11
12 step2_h = 25;
13 step2_w = 15;
14 step2_off = 40;
15
16 step23_plus = 7;
17
18 step3_h = -step2_h;
19 step3_w = 10;
20 step3_off = 40;
21
22 clip_wall = 1.5;
23 alu_w = 24 + 0.5;
24 alu_h = 8;
25 clip_end = 1;
26
27 module clip() {
28         difference() {
29                 cube([alu_w + 2*clip_wall, alu_h + clip_wall, body_w]);
30                 translate([clip_wall, clip_wall, -eps])
31                         cube([alu_w, alu_h + eps, body_w + 2*eps]);
32         }
33         translate([clip_wall, alu_h + clip_wall - clip_end, 0])
34                 cylinder(r = clip_end, h = body_w, $fn = 4);
35         translate([clip_wall + alu_w, alu_h + clip_wall - clip_end, 0])
36                 cylinder(r = clip_end, h = body_w, $fn = 4);
37 }
38         
39 module body() {
40         // cube to prevent rounded bottom
41         Ty(-10) cube([base_w, 10, body_w]);
42         // step 1
43         hull () {
44                 cube([base_w, eps, body_w]);
45                 translate([step1_off, step1_h, 0])
46                         cube([step1_w, eps, body_w]);
47         }
48
49         // step 2
50         translate([step1_off, step1_h, 0]) hull() {
51                 cube([step1_w, eps, body_w]);
52                 translate([step2_off, step2_h, 0])
53                         cube([step2_w, eps, body_w]);
54         }
55
56         // under the top corner
57         translate([step1_off + step2_off, step1_h + step2_h - step23_plus, 0])
58                 cube([step2_w, step23_plus, body_w]);
59         // step 3
60         translate([step1_off + step2_off, step1_h + step2_h, 0]) hull() {
61                 cube([step2_w, eps, body_w]);
62                 translate([step3_off, step3_h, 0])
63                         cube([step3_w, eps, body_w]);
64         }
65 }
66
67 screw_d1 = 3.5;
68 screw_wall = 3;
69 screw_d2 = 9;
70 screw_off = 10;
71
72 difference() {
73         round_with() {
74                 union() {
75                         Mz() cylinder(r1 = 1, r2 = 0, h = 2);
76                 }
77                 body();
78         }
79         // cut bottom
80         translate([-infty/2, -infty, -infty/2]) cube(infty);
81         translate([screw_off, -eps, body_w/2])
82                 Rx(-90) 
83                 cylinder(r = screw_d1/2, h = screw_wall + 2*eps, $fn = 6);
84         translate([screw_off, screw_wall, body_w/2])
85                 Rx(-90) 
86                 cylinder(r = screw_d2/2, h = step1_h, $fn = 6);
87 }
88
89         // upper clip
90         translate([step1_off + step2_off + step2_w/2-alu_w/2-clip_wall,
91                 step1_h + step2_h - clip_wall, 0])
92                 clip();
93
94         // lower clip
95         translate([step1_off+step2_off+step3_off+step3_w/2-alu_w/2-clip_wall,
96                 step1_h + step2_h + step3_h + clip_wall, 0])
97                 Sy(-1) clip();
98