]> www.fi.muni.cz Git - things.git/blob - bonsai-pot-tall.scad
switch holder.scad
[things.git] / bonsai-pot-tall.scad
1 infty = 200;
2 eps = 0.01;
3
4 wall = 2;
5
6 body_l = 180;
7 body_w1 = 35;
8 body_w2 = 40;
9 body_h = 130;
10 end_scale = 1.5;
11 center_hole_d = 5;
12
13 bottom_sep = 4;
14 bottom_h = 10;
15 bottom_leg_z = bottom_h-wall;
16
17 leg_w = 5;
18 leg_h1 = 12;
19 leg_h2 = 6;
20 leg_l = bottom_sep + 3*wall;
21 leg_off = body_l/2;
22
23 $fn = 128;
24
25 module main_shape(h, l, w1, w2, s) {
26         hull() {
27                 for (x = [-1, 1]) scale ([x, 1, 1])
28                 translate([l/2-w1*s/2, 0, 0])
29                 scale([s, 1, 1])
30                 cylinder(r1 = w1/2, r2 = w2/2, h = h);
31         }
32 }
33
34 module hollow_main_shape(h, l, w1, w2, s) {
35         difference() {
36                 main_shape(h, l+2*wall,
37                         w1+2*wall, w2+2*wall,
38                         s);
39                 translate([0, 0, wall])
40                 main_shape(h, l, w1, w2, s);
41         }
42 }
43
44 module bottom_main() {
45         hollow_main_shape(bottom_h, body_l+2*wall+bottom_sep, body_w1+2*wall+bottom_sep, body_w2+2*wall+bottom_sep, end_scale);
46 }
47
48 module legs() {
49         for (y = [-1, 1]) for (x = [-1, 1]) scale([x, y, 1])
50         translate([leg_off/2, body_w1/2+wall-eps, 0])
51         hull() {
52                 cube([leg_w, eps, leg_h1]);
53                 translate([0, leg_l-eps, 0])
54                 cube([leg_w, eps, leg_h2]);
55         }
56 }
57
58 module pot() {
59         difference() {
60                 hollow_main_shape(body_h, body_l, body_w1, body_w2, end_scale);
61                 // center hole
62                 translate([0, 0, -eps])
63                 cylinder(r = center_hole_d/2, h = wall + 2*eps);
64         }
65         difference() {
66                 legs();
67                 translate([0, 0, -bottom_leg_z]) bottom_main();
68         }
69 }
70
71 module bottom() {
72         difference() {
73                 bottom_main();
74                 translate([0, 0, bottom_leg_z]) legs();
75         }
76 }
77
78 bottom();
79 // translate([0, 0, bottom_h + wall]) pot();
80 translate([0, body_w2 + bottom_sep + leg_l + 2*wall, 0]) pot();