chiark / gitweb /
86c14833e2145182b73200685f1b4bad1e9c9de6
[reprap-play.git] / poster-tube-lid.scad
1 // -*- C -*-
2
3 main_dia = 71.2 + 0.50;
4 top_thick = 4;
5
6 main_cnr = 4.0;
7
8 rivet_posn = 6.0;
9 rivet_thick = 1.67;
10 rivet_width = 4.15 + 1.0;
11 rivet_tall = 5.51 + 0.49;
12
13 over_rivet_wall = 0.5;
14 side_rivet_gap = 1.5;
15
16 bayo_interf = 0.75;
17 bayo_behind = 3.5;
18 bayo_interf_width = 2.0;
19 bayo_interf_slope = 0.75;
20
21 seal_thick = 0.1;
22 seal_recess = [ 2.0, 2.0 ]; // recess depth, recess height
23
24 side_taper = 1.0;
25
26 bayo_above_gap = 1.0;
27
28 bayo_entry = bayo_behind/3;
29
30 bayo_slice_size = 1;
31
32 // calculated
33
34 bayo_entry_x = bayo_entry;
35 bayo_entry_z = bayo_entry;
36 bayo_inramp_x = bayo_entry;
37 bayo_inramp_z = bayo_entry;
38
39 side_height = rivet_posn + bayo_behind + rivet_thick/2;
40 side_thick = rivet_tall + over_rivet_wall;
41
42 top_z = top_thick + seal_thick;
43
44 bayo_entry = bayo_behind / 3.0;
45 bayo_top_z = bayo_behind + rivet_thick + bayo_above_gap;
46 bayo_entry_ramp = bayo_entry + bayo_interf;
47
48 rivet_entry_width = rivet_width + side_rivet_gap;
49
50 $fs=0.5;
51 $fa=1;
52
53 // bayonet definition
54
55 bayo_a = [ bayo_entry_x, 0 ];
56 bayo_p = [ 0, bayo_entry_z ];
57 bayo_n = [ 0, bayo_behind-bayo_inramp_z ];
58 bayo_m = [ bayo_inramp_x, bayo_behind ];
59 bayo_l = bayo_m + bayo_interf * [ 1/bayo_interf_slope,  1 ];
60 bayo_k = bayo_l + [ bayo_interf_width, 0 ];
61 bayo_j = bayo_k + bayo_interf * [ 1/bayo_interf_slope, -1 ];
62 bayo_i = bayo_j + [ rivet_width, 0 ];
63 bayo_h = [ bayo_i[0], bayo_behind + rivet_thick + bayo_above_gap ];
64 bayo_g = [ bayo_m[0] - rivet_width, bayo_h[1] ];
65
66 bayo_e = [-bayo_p[0], bayo_p[1]] - [rivet_entry_width,0];
67 bayo_d = [-bayo_a[0], bayo_a[1]] - [rivet_entry_width,0];
68 bayo_c = bayo_d + [0,-5];
69 bayo_b = bayo_a + [0,-5];
70
71 bayo_f = [ bayo_e[0], bayo_g[1] + (bayo_e[0] - bayo_g[0]) ];
72
73 bayo_polygon = [ bayo_a,
74                  bayo_b,
75                  bayo_c,
76                  bayo_d,
77                  bayo_e,
78                  bayo_f,
79                  bayo_g,
80                  bayo_h,
81                  bayo_i,
82                  bayo_j,
83                  bayo_k,
84                  bayo_l,
85                  bayo_m,
86                  bayo_n,
87                  bayo_p ];
88
89 echo(bayo_polygon);
90
91 module MainProfile(){
92   main_cnr_pos = [ side_thick, top_z ] - [1,1]*main_cnr;
93   translate(main_cnr_pos){
94     intersection(){
95       difference(){
96         circle(r = main_cnr);
97         circle(r = main_cnr * 0.5);
98       }
99       square([10,10]);
100     }
101   }
102   polygon([[ -1,                    seal_thick        ],
103            [ -1,                    top_z             ],
104            [ main_cnr_pos[0],       top_z             ],
105            [ side_thick,            main_cnr_pos[1]   ],
106            [ side_thick,            -side_height      ],
107            [ side_taper,            -side_height      ],
108            [ 0,                     -rivet_posn       ],
109            [ 0,                     -(seal_recess[0] + seal_recess[1]) ],
110            [ seal_recess[0],        -(seal_recess[0]) ],
111            [ seal_recess[0],        seal_thick        ],
112            ]);
113 }
114
115 module RotateProjectSlice(offset, poly, slice_size, nom_rad, real_rad){
116   // nom_rad > real_rad
117   rotate([0,0, atan2(offset, nom_rad) ]){
118     intersection(){
119       translate([-offset, -10, 0])
120         rotate([90,0,0])
121         linear_extrude(height= nom_rad*2)
122         polygon(poly);
123       translate([0,0, -25])
124         cylinder(h=50, r= real_rad);
125       translate([0,0, -25])
126         linear_extrude(height= 50)
127         polygon([ [ 0,0 ],
128                   [ -slice_size, -real_rad*2 ],
129                   [ +slice_size, -real_rad*2 ] ]);
130     }
131   }
132 }
133
134 module RotateProject(poly, x_min, x_max, slice_size, nom_rad, real_rad){
135   offs = [ for (i=[ x_min :
136                     slice_size :
137                     x_max + slice_size ]) i ];
138   echo (offs);
139   for (off=offs)
140     RotateProjectSlice(off, poly, slice_size, nom_rad, real_rad);
141 }
142
143 module BayonetCutout(){
144   RotateProject(bayo_polygon,
145                 bayo_c[0], bayo_i[0], bayo_slice_size,
146                 main_dia/2 + side_thick, 
147                 main_dia/2 + rivet_tall);
148 }
149
150 module ProfilesDemo(){
151   translate([-20,0]) MainProfile();
152   polygon(bayo_polygon);
153 }
154
155 //ProfilesDemo();
156 BayonetCutout();