]> www.fi.muni.cz Git - things.git/blob - koupelna-mrizka.scad
switch holder.scad
[things.git] / koupelna-mrizka.scad
1 include <yenyalib.scad>
2
3 sdk = 12;
4 d_in = 104;
5 d_out = 140;
6 wall = 1.2;
7 h_out = 3;
8 h_in = h_out + 8.5;
9 out_angle = 60;
10 thin_wall = 0.70;
11 rib_angle = 60;
12 rib_w = 5;
13 rib_dist = 9;
14 rib_off = 1;
15 top_beam_w = 15;
16 top_beam_h = 2;
17
18 clip_wall = 4;
19 clip_mid = clip_wall + 3;
20 clip_end_d = 40;
21
22 magnet_d = 10 + 0.5;
23 magnet_h = 0.8 + 0.1;
24
25 magnet_off = d_in/2 - 1.5*magnet_d;
26
27 $fn = 256;
28
29 difference() {
30         cylinder(r1 = d_out/2-h_out*cos(out_angle),
31                 r2 = d_out/2,
32                 h = h_out);
33         Tz(wall) cylinder(r1 = d_out/2-wall-h_out*cos(out_angle),
34                         r2 = d_out/2-wall,
35                         h = h_out);
36         Tz(-eps) cylinder(r = d_in/2-wall+eps,  h = wall+2*eps);
37 }
38
39 difference() {
40         cylinder(r = d_in/2, h = h_in);
41         Tz(-eps) cylinder(r = d_in/2-wall, h = h_in + 2*eps);
42 }
43
44 difference() {
45         intersection() {
46                 cylinder(r = d_in/2-wall/2, h = h_in);
47                 union() {
48                         for(i = [-d_in/2+rib_off:rib_dist:d_in/2]) Tx(i) Ty(-d_in/2) {
49                                 Tx(-rib_w/2) cube([rib_w, d_in, thin_wall]);
50                                 Tx(rib_w/2)Ry(-rib_angle) cube([h_in/cos(rib_angle), d_in, thin_wall]);
51                         }
52                         translate([-d_in/2, -top_beam_w/2, h_in-top_beam_h])
53                                 cube([d_in, top_beam_w, top_beam_h]);
54                 }
55         }
56         for (x = [-1, 1]) Sx(x) Tx(magnet_off) Tz(h_in-magnet_h)
57                 cylinder(r = magnet_d/2, h = magnet_h+eps);
58 }
59
60 Ty(d_out/2 + top_beam_w/2 + 5) difference() {
61         union() {
62                 for(x = [-1, 1]) Sx(x) {
63                         Tx(d_out/2-clip_end_d/2)
64                                 cylinder(r = clip_end_d/2, h = clip_wall);
65                 }
66                 hull() for(x = [-1, 1]) Sx(x) {
67                         Tx(d_out/2-top_beam_w/2)
68                                 cylinder(r = top_beam_w/2, h = clip_wall);
69                 }
70                 hull() for(x = [-1, 1]) Sx(x) {
71                         Tx(magnet_off)
72                                 cylinder(r = top_beam_w/2, h = clip_mid);
73                 }
74         }
75         for (x = [-1, 1]) Sx(x) Tx(magnet_off) Tz(clip_mid-magnet_h)
76                 cylinder(r = magnet_d/2, h = magnet_h+eps);
77         
78 }