misc uncomitted changes
[clinton/3d-models.git] / etc / canister.scad
1 // super simple canister
2 // 2018 Clinton Ebadi
3
4 // incense sticks are ~22cm
5 // add a few cm in cap for packaging
6
7 inner_d = 25;
8 inner_h = 215;
9 cap_inner_h = 35; // height inside of cap, above rim of the canister
10 cap_overlap = 10;
11 cap_tolerance = 0.3;
12
13 wall = 2;
14 base = 2;
15 sides = 7;
16
17
18 // calculated
19 outer_d = inner_d + wall*2;
20 outer_h = inner_h + base;
21
22 cap_outer_d = outer_d + wall*2 + cap_tolerance;
23 cap_outer_h = cap_inner_h + cap_overlap + base;
24
25 cap_bump_size = 0.75;
26 cap_bump_h = 3;
27 cap_bump_offset = 3;
28
29 echo (cap_bump_offset);
30
31
32 // other asserts, if I care enough...
33 //assert (cap_inner_h > cap_overlap);
34 //assert (cap_outer_h - cap_bump_offset > base);
35
36
37 //$fa = 0.1;
38 //$fs = 0.1;
39
40 canister_base ();
41 translate ([cap_outer_d + 1, 0, 0]) canister_cap ();
42 //#translate ([0, 0, outer_h + cap_inner_h + base]) rotate ([0, 180, 180]) canister_cap ();
43
44 //cap_bump ();
45
46 module cap_bump (cap_bump_size=cap_bump_size, cap_bump_h=cap_bump_h) {
47 cap_bump_d = outer_d+cap_bump_size/2;
48 hull () {
49 translate ([0, 0, 0])
50 cylinder (d = cap_bump_d, h = cap_bump_h/3, $fn = sides);
51 translate ([0, 0, cap_bump_h/3])
52 cylinder (d = cap_bump_d + cap_bump_size, h = cap_bump_h/3, $fn = sides);
53 translate ([0, 0, cap_bump_h/3*2])
54 cylinder (d = cap_bump_d, h = cap_bump_h/3, $fn = sides);
55 }
56 }
57
58 module canister_base () {
59 difference () {
60 union () {
61 cylinder (d = outer_d, h = outer_h, $fn = sides);
62 translate ([0, 0, outer_h - cap_overlap + cap_bump_offset]) cap_bump ();
63 translate ([0, 0, outer_h - cap_overlap - cap_bump_h - 0.2]) cap_bump (cap_bump_size = wall);
64 }
65 translate ([0, 0, base]) cylinder (d = inner_d, h = outer_h + 1, $fn = sides);
66 }
67 }
68
69 module canister_cap () {
70 tolerance_pct = 1.00;
71 difference () {
72 cylinder (d = cap_outer_d, h = cap_outer_h, $fn = sides);
73 translate ([0, 0, base]) cylinder (d = outer_d + cap_tolerance, h = cap_outer_h+1, $fn = sides);
74 translate ([0, 0, cap_outer_h - cap_bump_offset - cap_bump_h]) scale ([tolerance_pct, tolerance_pct, tolerance_pct]) rotate ([0, 0, 0]) cap_bump ();
75 }
76 }