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