]> www.fi.muni.cz Git - things.git/blob - vesak-filip-aktovka.scad
drzak na hlinikove pasky v koupelne
[things.git] / vesak-filip-aktovka.scad
1 include <yenyalib.scad>;
2
3 eps = 0.01;
4 infty = 200;
5
6 wall = 8;
7
8 inner_w = 82;
9 outer_w = inner_w + 2*30;
10 inner_w_round_r = 2;
11 body_h = 30;
12 bottom_w = 70;
13 top_w = bottom_w + 3*wall;
14 bottom_h = 60;
15
16 module top_part() {
17         difference() {
18                 round_with() {
19                         rounding();
20                         hull() {
21                                 Mx()
22                                 Tx(outer_w/2 - 4*wall)
23                                 Sx(2)
24                                         cylinder(r = 2*wall, h = body_h);
25                         }
26                 }
27                 translate([-outer_w/2-eps, -2*wall-eps, -eps])
28                         cube([outer_w + 2*eps, 2*wall-inner_w_round_r,
29                                 body_h + 2*eps]);
30                 Mx() translate([inner_w/2 + inner_w_round_r,
31                         -inner_w_round_r, -eps]) hull() {
32                         cylinder(r = inner_w_round_r, h = body_h + 2*eps);
33                         cube([inner_w/2, inner_w_round_r, body_h + 2*eps]);
34                 }
35         }
36 }
37
38 hole_d = 35;
39 hole_l = 1.25*hole_d;
40 hole_xoff = 0.2*(bottom_w-hole_d);
41 hole_yoff = bottom_h - 0.2*hole_d;
42 hole_top_yoff = 7;
43 hole_top_l = 20;
44 hook_top_rx = 8;
45 hook_top_ry = 12;
46 module bottom_part() {
47         difference() {
48                 hull() {
49                         Tx(-inner_w/2) Ty(-inner_w_round_r)
50                                 cube([inner_w, wall/2, body_h]);
51                         Ty(-bottom_h) cylinder(r = bottom_w/2, h = body_h);
52                 }
53                 // main hole
54                 difference() {
55                         hull() {
56                                 translate([hole_xoff, -hole_yoff, -eps])
57                                         cylinder(r = hole_d/2, h = body_h+2*eps);
58                                 translate([hole_xoff,
59                                         -hole_yoff-hole_d+hole_l, -eps])
60                                         cylinder(r = hole_d/2, h = body_h+2*eps);
61                         }
62                         // rounded hook inner bottom
63                         translate([-inner_w/2, -hole_yoff-hole_d/2, body_h/2])
64                         Sy(0.7)
65                         Ry(90)
66                                 cylinder(r = 0.55*body_h, h = inner_w);
67                 }
68                 // cut to the top
69                 hull() {
70                         translate([inner_w/2+inner_w_round_r,
71                                 -hole_top_l-hole_top_yoff, -eps])
72                                 cube([eps, hole_top_l, body_h+2*eps]);
73                         translate([hole_xoff, -hole_yoff-hole_d+hole_l, -eps])
74                                 intersection() {
75                                         cylinder(r = hole_d/2, h = body_h+2*eps);
76                                         translate([-infty, 0, -infty/2])
77                                                 cube(infty);
78                                 }
79                 }
80                 // rounded hook end
81                 difference() {
82                         translate([hole_xoff, -hole_yoff, -eps])
83                                 cube([inner_w/2, hole_l-hole_d/2, body_h+2*eps]);
84                         translate([hole_xoff + hole_d/2 + hook_top_rx - 2*eps,
85                                 -hole_yoff, -2*eps])
86                                 Sy(hook_top_ry/hook_top_rx)
87                                 cylinder(r = hook_top_rx, h = body_h + 4*eps);
88                 }
89         }
90 }
91
92 module rounding() {
93         Mz() cylinder(r1 = 3, r2 = 0, h = 4.5, $fn = 8);
94 }
95         
96
97 $fn = 128;
98 top_part();
99
100 Mx() Tx(outer_w/2-3) Ty(3)
101         cylinder(r = 15, h = 0.4);
102
103 round_with() {
104         rounding();
105         bottom_part();
106 }
107
108
109 /*
110 // rotate_extrude(angle=360, convexity=10) {
111
112 outer_d = 1.1*body_h;
113 inner_d = body_h - 1.7*wall;
114 inner_scale = 1.5;
115 hole_depth = 0.01*bottom_h;
116 difference() {
117         difference() {
118                 union() {
119                         Ty(outer_d/2-eps) square([body_h, bottom_h - outer_d/2 + eps]);
120                         intersection() {
121                                 square(body_h);
122                                 Tx(body_h/2) Ty(outer_d/2)
123                                         circle(r = outer_d/2);
124                         }
125                 }
126                 hull() {
127                         Tx(body_h) Ty(bottom_h-hole_depth)
128                                 square([eps, hole_depth]);
129                         Tx(wall + inner_d/2) Ty(wall + inner_scale*inner_d/2)
130                                 Sy(inner_scale)
131                                 circle(r = inner_d/2);
132                         Tx(wall + inner_d/2) Ty(wall + inner_d/2)
133                                 circle(r = inner_d/2);
134                 }
135         }
136 }
137 */
138