chiark / gitweb /
poster-tube-lid: catch wip
[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.30;
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.30;
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 oring_compress_more = 0.2;
34
35 oring_rm_beside = 8;
36 oring_rm_scale = 2.0;
37 oring_rm_angle = 20;
38
39 side_taper = 1.0;
40
41 bayo_gap = 6.0;
42
43 bayo_entry = bayo_behind/3;
44
45 bayo_slice_size = coarse ? 5 : 1;
46
47 brace_hole_width = 1.0;
48 brace_above_below = 1.2;
49 brace_end_shorter = 0.3;
50
51 jig_thick = 1.4;
52 jig_hole_dia = 3.0;
53 jig_rim = 5;
54 jig_mark = 5;
55
56 strap_hoop_thick = 6;
57 strap_hoop_inside = 10;
58 strap_hoop_strlen = 10;
59 strap_hoop_elevation = 45;
60
61 sm_inner_circum = 218 - 1.90 - 1.00 - 0.50;
62 sm_main_thick = 2.0;
63 sm_main_width = 20;
64
65 sm_bolt_dia = 3.5 + 0.1;
66 sm_bolt_shaft = 21.9;
67 sm_bolt_head_dia = 6.94 + 1.0;
68 sm_bolt_head_thick = 2.14;
69 sm_bolt_nut_width = 5.89 + 0.25;
70 sm_bolt_nut_thick = 3.68;
71 sm_bolt_tighten_allow = 2.0;
72
73 sm_bolt_y_clear = 0.75;
74 sm_bolt_y_over = 0.5;
75
76 sm_closure_cnr = 3.0;
77
78 catch_stem_h = 3;
79 catch_stem_len = 50;
80 catch_stem_th = 3;
81
82 catch_knob_dia = 6;
83 catch_knob_above_gap = 8;
84 catch_stem_end_h = 12;
85 catch_pin_height = 7;
86
87 catch_stem_below_gap = 1.0;
88 catch_stem_beside_gap = 2.0;
89 catch_pin_gap = 0.5;
90
91 // calculated
92
93 TAU = PI*2;
94
95 bayo_entry_x = bayo_entry;
96 bayo_entry_z = bayo_entry;
97 bayo_inramp_x = bayo_entry;
98 bayo_inramp_z = bayo_entry;
99
100 oring_mid_dia = oring_bore + oring_thick;
101 oring_outer_dia = oring_mid_dia + oring_thick;
102
103 oring_oblate = (1 - oring_compress);
104
105 oring_y_rad = oring_thick/2 * oring_oblate;
106 oring_x_rad = oring_thick/2 / oring_oblate;
107
108 by_oring_z = oring_y_rad * (1 + cos(oring_upper_embed_angle));
109
110 side_height = rivet_posn + bayo_behind + rivet_thick/2;
111 side_thick = rivet_tall + over_rivet_wall;
112
113 top_z = top_thick_by_oring + oring_y_rad + by_oring_z;
114
115 middle_bot_z = top_z - top_thick_middle;
116
117 bayo_entry = bayo_behind / 3.0;
118 bayo_top_z = bayo_behind + bayo_gap;
119
120 rivet_entry_width = rivet_width + side_rivet_gap;
121
122 jig_mark_rad = jig_mark + main_dia/2 + jig_thick;
123
124 handling_dia = oring_bore + oring_thick*2 + min_wall*2;
125 handling_angle = 45;
126
127 sm_inner_rad = (sm_inner_circum + sm_bolt_tighten_allow/2) / TAU;
128 sm_outer_rad = sm_inner_rad + sm_main_thick;
129
130 smc_pos = [ 0, sm_inner_rad, 0 ];
131
132 smc_bolt_nut_dia = sm_bolt_nut_width / cos(30);
133 smc_bolt_nut_eff_thick = sm_bolt_nut_thick + sm_bolt_tighten_allow;
134
135 smc_bolt_y = sm_bolt_dia/2 + sm_bolt_y_clear;
136 smc_max_y = smc_bolt_y + sm_bolt_y_over
137   + max(sm_bolt_head_dia/2, smc_bolt_nut_dia/2);
138 smc_cnr_c_x = sm_bolt_shaft/2 - sm_closure_cnr
139   + sm_bolt_head_thick/2 + smc_bolt_nut_eff_thick/2;
140
141 catch_cr = catch_knob_dia/2 + catch_stem_beside_gap;
142 catch_strap_width = sm_main_width;
143
144 cpp0 = [0,0];
145 cpp1 = cpp0 + [0,1] * catch_pin_height;
146 cpp2 = cpp0 + [1,0] * (rivet_entry_width - catch_pin_gap);
147 cpp3 = cpp2 + [0,-1] * catch_stem_end_h;
148 cpp4 = cpp2 + [0,-1] * catch_stem_end_h;
149 cpp5 = [ cpp0[0] - catch_stem_len,
150          cpp0[1] - (catch_stem_h + catch_cr) ];
151 cppB = [ 0.5*(cpp1 + cpp2)[0],
152          cpp1[1] - catch_pin_height - catch_knob_above_gap -
153          0.5 * catch_knob_dia ];
154 cpp7 = cppB + [-1,-1] * catch_knob_dia/2
155             + [ catch_stem_beside_gap, -catch_stem_below_gap ]
156             + [ 0, -catch_pin_height ]
157             + [-1,1] * catch_cr;
158 cpp6 = [ cpp5[0], cpp7[1] ];
159 cpp8 = [ cpp7[0] + catch_cr*2,
160          cpp0[0] - catch_cr ];
161 cppC = cpp8 + [1,1] * catch_cr;
162 cppA = [ cpp5[0] - catch_cr*2, cpp0[1] ];
163 cppD = cppC + [0,-1] * catch_strap_width;
164 cppE = [ cppA[0], cppD[1] ];
165
166 $fs= coarse ? 2.5 : 0.5;
167 $fa= coarse ? 5 : 1;
168
169 include <poster-tube-lid-parametric.scad>
170
171 // bayonet definition
172
173 bayo_a = [ bayo_entry_x, 0 ];
174 bayo_p = [ 0, bayo_entry_z ];
175 bayo_n = [ 0, bayo_behind-bayo_inramp_z ];
176 bayo_m = [ bayo_inramp_x, bayo_behind ];
177 bayo_l = bayo_m + bayo_interf * [ 1/bayo_interf_slope,  1 ];
178 bayo_k = bayo_l + [ bayo_interf_width, 0 ];
179 bayo_j = bayo_k + bayo_interf * [ 1/bayo_interf_slope, -1 ];
180 bayo_i = bayo_j + [ rivet_width + inside_rivet_gap, 0 ];
181 bayo_h = [ bayo_i[0], bayo_behind + bayo_gap + bayo_interf ];
182 bayo_g = [ bayo_m[0] - rivet_width, bayo_h[1] ];
183
184 bayo_e = [-bayo_p[0], bayo_p[1]] - [rivet_entry_width,0];
185 bayo_d = [-bayo_a[0], bayo_a[1]] - [rivet_entry_width,0];
186 bayo_c = bayo_d + [0,-5];
187 bayo_b = bayo_a + [0,-5];
188
189 bayo_f = [ bayo_e[0], bayo_g[1] + (bayo_e[0] - bayo_g[0]) ];
190
191 bayo_polygon = [ bayo_a,
192                  bayo_b,
193                  bayo_c,
194                  bayo_d,
195                  bayo_e,
196                  bayo_f,
197                  bayo_g,
198                  bayo_h,
199                  bayo_i,
200                  bayo_j,
201                  bayo_k,
202                  bayo_l,
203                  bayo_m,
204                  bayo_n,
205                  bayo_p ];
206
207 echo(bayo_polygon);
208
209 module MainProfile(){
210   main_cnr_pos = [ side_thick, top_z ] - [1,1]*main_cnr;
211   difference(){
212     union(){
213       translate(main_cnr_pos){
214         intersection(){
215           difference(){
216             circle(r = main_cnr);
217             circle(r = main_cnr * 0.5);
218           }
219           square([10,10]);
220         }
221       }
222       polygon([[ -top_middle_dr,        middle_bot_z      ],
223                [ -top_middle_dr,        top_z             ],
224                [ main_cnr_pos[0],       top_z             ],
225                [ side_thick,            main_cnr_pos[1]   ],
226                [ side_thick,            -side_height      ],
227                [ side_taper,            -side_height      ],
228                [ 0,                     -rivet_posn       ],
229                [ 0,                     by_oring_z        ],
230                [ -oring_x_rad,          by_oring_z        ],
231                ],
232               convexity=10);
233     }
234     translate([ oring_mid_dia/2 - main_dia/2, 0 ])
235       hull(){
236       translate([ 0, oring_y_rad ])
237         scale([ 1/oring_oblate * (oring_compress_more+1) , oring_oblate ])
238         circle(oring_thick/2);
239       translate([ 0, oring_y_rad*2 - oring_thick/2 ])
240         circle(oring_thick/2);
241     }
242   }
243 }
244
245 module StrapHoopProfile(){
246   circle(r = strap_hoop_thick/2);
247 }
248
249 module StrapHoop(){ ////toplevel
250   bigrad = strap_hoop_inside/2 + strap_hoop_thick/2;
251   extralen = strap_hoop_thick * 5;
252
253   intersection(){
254     rotate([strap_hoop_elevation, 0,0]){
255       for (x= [ -1, +1 ] * bigrad) {
256         translate([x, -extralen, 0])
257           rotate([-90,0,0])
258           linear_extrude(height= extralen + strap_hoop_strlen + 0.1,
259                          convexity=10)
260           StrapHoopProfile();
261       }
262       translate([0, strap_hoop_strlen, 0]){
263         intersection(){
264           rotate_extrude(convexity=10)
265             translate([bigrad, 0,0])
266             StrapHoopProfile();
267           translate([0,50,0])
268             cube([100,100,100], center=true);
269         }
270       }
271     }
272     translate([0, 50, 0])
273       cube(100, center=true);
274   }
275 }
276
277 module RotateProjectSlice(offset, slice_size, nom_rad, real_rad){
278   // nom_rad > real_rad
279   rotate([0,0, atan2(offset, nom_rad) ]){
280     intersection(){
281       translate([-offset, -10, 0])
282         rotate([90,0,0])
283         linear_extrude(height= nom_rad*2)
284         children(0);
285       translate([0,0, -25])
286         cylinder(h=50, r= real_rad);
287       translate([0,0, -25])
288         linear_extrude(height= 50)
289         polygon([ [ 0,0 ],
290                   [ -slice_size, -real_rad*2 ],
291                   [ +slice_size, -real_rad*2 ] ]);
292     }
293   }
294 }
295
296 module RotateProject(x_min, x_max, slice_size, nom_rad, real_rad){
297   offs = [ for (i=[ x_min :
298                     slice_size :
299                     x_max + slice_size ]) i ];
300   echo (offs);
301   for (off=offs)
302     RotateProjectSlice(off, slice_size, nom_rad, real_rad)
303     children(0);
304 }
305
306 module BayonetCutout(){
307   RotateProject(bayo_c[0], bayo_i[0], bayo_slice_size,
308                 main_dia/2 + side_thick, 
309                 main_dia/2 + rivet_tall)
310     translate([-0.5 * (bayo_a[0] + bayo_d[0]), 0])
311     polygon(bayo_polygon, convexity=10);
312 }
313
314 module ProfilesDemo(){ ////toplevel
315   translate([-10,0]) MainProfile();
316   translate([+10, -side_height]) polygon(bayo_polygon, convexity=10);
317 }
318
319 module LimitForHandling(){ ////toplevel
320   hull() for (r=[0,180])
321     rotate([0,0,r]) {
322       for (rs=[-1,+1]) {
323         for (xd=[0,1]) {
324           rotate([0,0, rs * handling_angle/2]) {
325             translate([rs * xd * main_dia/2 * tan(handling_angle/2),
326                        main_dia/2 + side_thick - main_cnr,
327                        top_z - main_cnr]) {
328               mirror([0,0,1])
329                 cylinder(r= main_cnr, h=50);
330               sphere(main_cnr);
331             }
332           }
333         }
334       } 
335     }
336   hull() rotate_extrude(){
337     translate([ handling_dia/2 - main_cnr, top_z - main_cnr ]) {
338       circle(r = main_cnr);
339       mirror([0,1]) square([ main_cnr, 50 ]);
340     }
341   }
342   //cylinder(r= handling_dia/2, h=20);
343 }
344
345 module Cover(){ ////toplevel
346   render() difference(){
347     intersection(){
348       union(){
349         rotate_extrude(convexity=10)
350           translate([main_dia/2, 0])
351           MainProfile();
352         translate([0,0, middle_bot_z])
353           cylinder(h= top_thick_middle, r = main_dia/2 - top_middle_dr + 1);
354       }
355       LimitForHandling();
356     }
357     for (r=[0,180]){
358       rotate([0,0, r])
359         translate([0,0, -side_height])
360         BayonetCutout();
361       rotate([0,0, r + asin((-oring_rm_beside) / (main_dia/2))])
362         translate([0,
363                    oring_mid_dia/2 + oring_thick/4 * oring_rm_scale,
364                    oring_y_rad * 1.5])
365         rotate([-oring_rm_angle, 0, 0])
366         mirror([0,0,1])
367         cylinder(r = oring_thick/4 * oring_rm_scale, h=20);
368     }
369     for (r=[0 : 60 : 179]) {
370       rotate([0,0, r]) {
371         height = top_thick_middle - brace_above_below*2;
372         translate([0,0, middle_bot_z + brace_above_below + height/2 ])
373         cube(center=true, [ oring_bore - brace_end_shorter,
374                             brace_hole_width, height ]);
375       }
376     }
377   }
378   for (r=[0,180])
379     rotate([0,0,r])
380       translate([-implheadcup_large_dia * .5 - implheadcup_thick/2,
381                  -implheadcup_large_dia * .0,
382                  middle_bot_z + 0.1])
383       ImplHeadCup();
384 //  translate(strap_hoop_thick * [-0.5, 0, +1])
385 //    translate([handling_dia/2, 0, -side_height])
386 //    rotate([0,180,0]) rotate([0,0,90])
387 //    StrapHoop();
388 }
389
390 module SavingHole(){
391   translate([0,0, -10])
392     cylinder(r= main_dia/2 - jig_rim, h=20);
393 }
394
395 module Jig(){ ////toplevel
396   difference(){
397     union(){
398       translate([0,0, -side_height]){
399         cylinder(r= main_dia/2 + jig_thick, h= side_height + jig_thick);
400       }
401       translate([-jig_mark_rad, 0, jig_thick - jig_mark])
402         cube([jig_mark_rad*2, jig_mark, jig_mark]);
403     }
404     translate([0,0, -side_height-1])
405       cylinder(r= main_dia/2, h= side_height + 1);
406     SavingHole();
407     translate([0,0, -rivet_posn])
408       rotate([90, 0,0])
409       translate([0,0, -100])
410       cylinder(r= jig_hole_dia/2, h = 200);
411   }
412 }
413
414 module CoverTest2(){ ////toplevel
415   difference(){
416     Cover();
417     SavingHole();
418   }
419 }
420
421 module CoverTest1(){ ////toplevel
422   difference(){
423     CoverTest2();
424     difference(){
425       for (r= [ 40, 147 ]){
426         rotate([0,0, r]){
427           translate([0,0, -10]) {
428             cube([ main_dia*3, main_dia * .53, 18], center=true);
429           }
430         }
431       }
432 //      translate([ 50, 0, 0 ])
433 //      cube([ 100,
434 //             strap_hoop_inside + strap_hoop_thick*2 + 1,
435 //             100 ],
436 //           center=true);
437     }
438   }
439 }
440
441 module ImplHeadCupTest(){ ////toplevel
442   for (r=[0,180])
443     rotate([0,0,r])
444       translate([-17,0,0])
445       ImplHeadCup();
446 }
447
448 module StrapMountBolt(l_delta){ ///toplevel
449   // positioned relative to smc_pos
450   translate([(smc_bolt_nut_eff_thick - sm_bolt_head_thick)/2,
451              smc_bolt_y,
452              sm_main_width/2]){
453     translate([ -sm_bolt_shaft/2-1, 0,0 ]){
454       rotate([0,90,0]) cylinder(r= sm_bolt_dia/2, h= sm_bolt_shaft+2);
455     }
456     translate([ -sm_bolt_shaft/2, 0,0 ])
457       rotate([0,-90,0])
458       cylinder($fn=6, r=smc_bolt_nut_dia/2,
459                h=smc_bolt_nut_eff_thick + l_delta);
460     translate([ sm_bolt_shaft/2, 0,0 ])
461       rotate([0,90,0])
462       cylinder(r=sm_bolt_head_dia/2, h=sm_bolt_head_thick + l_delta);
463   }
464 }
465
466 module StrapMountProtrusion(half_x, max_y, cnr){
467   translate(smc_pos){
468     linear_extrude(height=sm_main_width, convexity=10){
469       hull(){
470         for (m = [0,1]) mirror([m,0,0]) {
471           translate([-(half_x - cnr), max_y - cnr])
472             circle(r=cnr);
473           translate([-half_x, -sm_inner_rad])
474             square([1,1]);
475         }
476       }
477     }
478   }
479 }
480
481 module StrapMount(){ ////toplevel
482   difference(){
483     union(){
484       cylinder(r=sm_outer_rad, h=sm_main_width);
485       StrapMountProtrusion(smc_cnr_c_x + sm_closure_cnr,
486                            smc_max_y,
487                            sm_closure_cnr);
488       rotate([0,0,180]){
489         StrapMountProtrusion(strap_hoop_inside/2 + strap_hoop_thick,
490                              strap_hoop_thick,
491                              sm_closure_cnr);
492         translate(smc_pos +
493                   [0,0, sm_main_width] +
494                   strap_hoop_thick * [ 0, 0.5, -1.0 ])
495           StrapHoop();
496       }
497     }
498     translate([0,0,-1])
499       cylinder(r=sm_inner_rad, h=sm_main_width+2);
500     translate(smc_pos)
501       StrapMountBolt(10);
502     translate(smc_pos)
503       cube([ sm_bolt_tighten_allow, 40,100 ], center=true);
504   }
505 }
506
507 module CatchCoreProfile(){
508   difference(){
509     polygon([ cpp4,
510               cpp3,
511               cpp2,
512               cpp1,
513               cpp0,
514               cppA,
515               cppE,
516               cppD,
517               cppC,
518               ]);
519   }
520 }
521
522 //ProfilesDemo();
523 //BayonetCutout();
524 //MainProfile();
525 //Cover();
526 //Jig();
527 //CoverTest();