chiark / gitweb /
poster-tube-lid: drop StrapHoop from Cover
[reprap-play.git] / poster-tube-lid.scad
1 // -*- C -*-
2
3 coarse = false;
4
5 main_dia = 71.2 + 0.50 - 2.26;
6 top_thick_middle = 4;
7 top_thick_by_oring = 3.0;
8 top_middle_dr = 11;
9
10 main_cnr = 6.0;
11
12 min_wall = 3;
13
14 rivet_posn = 6.0 + 0.6;
15 rivet_thick = 1.67;
16 rivet_width = 4.15 + 1.0;
17 rivet_tall = 5.51 + 1.49;
18
19 over_rivet_wall = 1.0;
20 side_rivet_gap = 1.5;
21 inside_rivet_gap = 1.5;
22
23 bayo_interf = 0.85;
24 bayo_behind = 3.5;
25 bayo_interf_width = 2.0;
26 bayo_interf_slope = 0.5;
27
28 oring_thick = 5.0;
29 oring_bore = 62.0;
30
31 oring_upper_embed_angle = 80;
32 oring_compress = 0.1; // proportion
33
34 oring_rm_beside = 8;
35 oring_rm_scale = 2.0;
36 oring_rm_angle = 20;
37
38 side_taper = 1.0;
39
40 bayo_gap = 6.0;
41
42 bayo_entry = bayo_behind/3;
43
44 bayo_slice_size = coarse ? 5 : 1;
45
46 brace_hole_width = 1.0;
47 brace_above_below = 1.2;
48 brace_end_shorter = 0.3;
49
50 jig_thick = 1.4;
51 jig_hole_dia = 3.0;
52 jig_rim = 5;
53 jig_mark = 5;
54
55 strap_hoop_thick = 6;
56 strap_hoop_inside = 10;
57 strap_hoop_strlen = 10;
58 strap_hoop_elevation = 45;
59
60 // calculated
61
62 bayo_entry_x = bayo_entry;
63 bayo_entry_z = bayo_entry;
64 bayo_inramp_x = bayo_entry;
65 bayo_inramp_z = bayo_entry;
66
67 oring_mid_dia = oring_bore + oring_thick;
68 oring_outer_dia = oring_mid_dia + oring_thick;
69
70 oring_oblate = (1 - oring_compress);
71
72 oring_y_rad = oring_thick/2 * oring_oblate;
73 oring_x_rad = oring_thick/2 / oring_oblate;
74
75 by_oring_z = oring_y_rad * (1 + cos(oring_upper_embed_angle));
76
77 side_height = rivet_posn + bayo_behind + rivet_thick/2;
78 side_thick = rivet_tall + over_rivet_wall;
79
80 top_z = top_thick_by_oring + oring_y_rad + by_oring_z;
81
82 middle_bot_z = top_z - top_thick_middle;
83
84 bayo_entry = bayo_behind / 3.0;
85 bayo_top_z = bayo_behind + bayo_gap;
86
87 rivet_entry_width = rivet_width + side_rivet_gap;
88
89 jig_mark_rad = jig_mark + main_dia/2 + jig_thick;
90
91 handling_dia = oring_bore + oring_thick*2 + min_wall*2;
92 handling_angle = 45;
93
94 $fs= coarse ? 2.5 : 0.5;
95 $fa= coarse ? 5 : 1;
96
97 // bayonet definition
98
99 bayo_a = [ bayo_entry_x, 0 ];
100 bayo_p = [ 0, bayo_entry_z ];
101 bayo_n = [ 0, bayo_behind-bayo_inramp_z ];
102 bayo_m = [ bayo_inramp_x, bayo_behind ];
103 bayo_l = bayo_m + bayo_interf * [ 1/bayo_interf_slope,  1 ];
104 bayo_k = bayo_l + [ bayo_interf_width, 0 ];
105 bayo_j = bayo_k + bayo_interf * [ 1/bayo_interf_slope, -1 ];
106 bayo_i = bayo_j + [ rivet_width + inside_rivet_gap, 0 ];
107 bayo_h = [ bayo_i[0], bayo_behind + bayo_gap + bayo_interf ];
108 bayo_g = [ bayo_m[0] - rivet_width, bayo_h[1] ];
109
110 bayo_e = [-bayo_p[0], bayo_p[1]] - [rivet_entry_width,0];
111 bayo_d = [-bayo_a[0], bayo_a[1]] - [rivet_entry_width,0];
112 bayo_c = bayo_d + [0,-5];
113 bayo_b = bayo_a + [0,-5];
114
115 bayo_f = [ bayo_e[0], bayo_g[1] + (bayo_e[0] - bayo_g[0]) ];
116
117 bayo_polygon = [ bayo_a,
118                  bayo_b,
119                  bayo_c,
120                  bayo_d,
121                  bayo_e,
122                  bayo_f,
123                  bayo_g,
124                  bayo_h,
125                  bayo_i,
126                  bayo_j,
127                  bayo_k,
128                  bayo_l,
129                  bayo_m,
130                  bayo_n,
131                  bayo_p ];
132
133 echo(bayo_polygon);
134
135 module MainProfile(){
136   main_cnr_pos = [ side_thick, top_z ] - [1,1]*main_cnr;
137   difference(){
138     union(){
139       translate(main_cnr_pos){
140         intersection(){
141           difference(){
142             circle(r = main_cnr);
143             circle(r = main_cnr * 0.5);
144           }
145           square([10,10]);
146         }
147       }
148       polygon([[ -top_middle_dr,        middle_bot_z      ],
149                [ -top_middle_dr,        top_z             ],
150                [ main_cnr_pos[0],       top_z             ],
151                [ side_thick,            main_cnr_pos[1]   ],
152                [ side_thick,            -side_height      ],
153                [ side_taper,            -side_height      ],
154                [ 0,                     -rivet_posn       ],
155                [ 0,                     by_oring_z        ],
156                [ -oring_x_rad,          by_oring_z        ],
157                ],
158               convexity=10);
159     }
160     translate([ oring_mid_dia/2 - main_dia/2, 0 ])
161       hull(){
162       translate([ 0, oring_y_rad ])
163         scale([ 1/oring_oblate, oring_oblate ])
164         circle(oring_thick/2);
165       translate([ 0, oring_y_rad*2 - oring_thick/2 ])
166         circle(oring_thick/2);
167     }
168   }
169 }
170
171 module StrapHoopProfile(){
172   circle(r = strap_hoop_thick/2);
173 }
174
175 module StrapHoop(){ ////toplevel
176   bigrad = strap_hoop_inside/2 + strap_hoop_thick/2;
177   extralen = strap_hoop_thick * 5;
178
179   intersection(){
180     rotate([strap_hoop_elevation, 0,0]){
181       for (x= [ -1, +1 ] * bigrad) {
182         translate([x, -extralen, 0])
183           rotate([-90,0,0])
184           linear_extrude(height= extralen + strap_hoop_strlen + 0.1,
185                          convexity=10)
186           StrapHoopProfile();
187       }
188       translate([0, strap_hoop_strlen, 0]){
189         intersection(){
190           rotate_extrude(convexity=10)
191             translate([bigrad, 0,0])
192             StrapHoopProfile();
193           translate([0,50,0])
194             cube([100,100,100], center=true);
195         }
196       }
197     }
198     translate([0, 50, 0])
199       cube(100, center=true);
200   }
201 }
202
203 module HandlingProfile(){
204 //  translate([
205 }
206
207 module RotateProjectSlice(offset, slice_size, nom_rad, real_rad){
208   // nom_rad > real_rad
209   rotate([0,0, atan2(offset, nom_rad) ]){
210     intersection(){
211       translate([-offset, -10, 0])
212         rotate([90,0,0])
213         linear_extrude(height= nom_rad*2)
214         children(0);
215       translate([0,0, -25])
216         cylinder(h=50, r= real_rad);
217       translate([0,0, -25])
218         linear_extrude(height= 50)
219         polygon([ [ 0,0 ],
220                   [ -slice_size, -real_rad*2 ],
221                   [ +slice_size, -real_rad*2 ] ]);
222     }
223   }
224 }
225
226 module RotateProject(x_min, x_max, slice_size, nom_rad, real_rad){
227   offs = [ for (i=[ x_min :
228                     slice_size :
229                     x_max + slice_size ]) i ];
230   echo (offs);
231   for (off=offs)
232     RotateProjectSlice(off, slice_size, nom_rad, real_rad)
233     children(0);
234 }
235
236 module BayonetCutout(){
237   RotateProject(bayo_c[0], bayo_i[0], bayo_slice_size,
238                 main_dia/2 + side_thick, 
239                 main_dia/2 + rivet_tall)
240     translate([-0.5 * (bayo_a[0] + bayo_d[0]), 0])
241     polygon(bayo_polygon, convexity=10);
242 }
243
244 module ProfilesDemo(){ ////toplevel
245   translate([-10,0]) MainProfile();
246   translate([+10, -side_height]) polygon(bayo_polygon, convexity=10);
247 }
248
249 module LimitForHandling(){ ////toplevel
250   hull() for (r=[0,180])
251     rotate([0,0,r]) {
252       for (rs=[-1,+1]) {
253         for (xd=[0,1]) {
254           rotate([0,0, rs * handling_angle/2]) {
255             translate([rs * xd * main_dia/2 * tan(handling_angle/2),
256                        main_dia/2 + side_thick - main_cnr,
257                        top_z - main_cnr]) {
258               mirror([0,0,1])
259                 cylinder(r= main_cnr, h=50);
260               sphere(main_cnr);
261             }
262           }
263         }
264       } 
265     }
266   hull() rotate_extrude(){
267     translate([ handling_dia/2 - main_cnr, top_z - main_cnr ]) {
268       circle(r = main_cnr);
269       mirror([0,1]) square([ main_cnr, 50 ]);
270     }
271   }
272   //cylinder(r= handling_dia/2, h=20);
273 }
274
275 module Cover(){ ////toplevel
276   render() difference(){
277     intersection(){
278       union(){
279         rotate_extrude(convexity=10)
280           translate([main_dia/2, 0])
281           MainProfile();
282         translate([0,0, middle_bot_z])
283           cylinder(h= top_thick_middle, r = main_dia/2 - top_middle_dr + 1);
284       }
285       LimitForHandling();
286     }
287     for (r=[0,180]){
288       rotate([0,0, r])
289         translate([0,0, -side_height])
290         BayonetCutout();
291       rotate([0,0, r + asin((-oring_rm_beside) / (main_dia/2))])
292         translate([0,
293                    oring_mid_dia/2 + oring_thick/4 * oring_rm_scale,
294                    oring_y_rad * 1.5])
295         rotate([-oring_rm_angle, 0, 0])
296         mirror([0,0,1])
297         cylinder(r = oring_thick/4 * oring_rm_scale, h=20);
298     }
299     for (r=[0 : 60 : 179]) {
300       rotate([0,0, r]) {
301         height = top_thick_middle - brace_above_below*2;
302         translate([0,0, middle_bot_z + brace_above_below + height/2 ])
303         cube(center=true, [ oring_bore - brace_end_shorter,
304                             brace_hole_width, height ]);
305       }
306     }
307   }
308 //  translate(strap_hoop_thick * [-0.5, 0, +1])
309 //    translate([handling_dia/2, 0, -side_height])
310 //    rotate([0,180,0]) rotate([0,0,90])
311 //    StrapHoop();
312 }
313
314 module SavingHole(){
315   translate([0,0, -10])
316     cylinder(r= main_dia/2 - jig_rim, h=20);
317 }
318
319 module Jig(){ ////toplevel
320   difference(){
321     union(){
322       translate([0,0, -side_height]){
323         cylinder(r= main_dia/2 + jig_thick, h= side_height + jig_thick);
324       }
325       translate([-jig_mark_rad, 0, jig_thick - jig_mark])
326         cube([jig_mark_rad*2, jig_mark, jig_mark]);
327     }
328     translate([0,0, -side_height-1])
329       cylinder(r= main_dia/2, h= side_height + 1);
330     SavingHole();
331     translate([0,0, -rivet_posn])
332       rotate([90, 0,0])
333       translate([0,0, -100])
334       cylinder(r= jig_hole_dia/2, h = 200);
335   }
336 }
337
338 module CoverTest2(){ ////toplevel
339   difference(){
340     Cover();
341     SavingHole();
342   }
343 }
344
345 module CoverTest1(){ ////toplevel
346   difference(){
347     CoverTest2();
348     difference(){
349       for (r= [ 40, 147 ]){
350         rotate([0,0, r]){
351           translate([0,0, -10]) {
352             cube([ main_dia*3, main_dia * .53, 18], center=true);
353           }
354         }
355       }
356 //      translate([ 50, 0, 0 ])
357 //      cube([ 100,
358 //             strap_hoop_inside + strap_hoop_thick*2 + 1,
359 //             100 ],
360 //           center=true);
361     }
362   }
363 }
364
365 //ProfilesDemo();
366 //BayonetCutout();
367 //MainProfile();
368 //Cover();
369 //Jig();
370 //CoverTest();