chiark / gitweb /
poster-tube-lid: WallMountForBase wip
[reprap-play.git] / poster-tube-lid.scad
1 // -*- C -*-
2
3 // Print, for each end:
4 //
5 //   CoverPrint
6 //   StrapMount
7 //   CatchAssembly
8
9 include <funcs.scad>
10 include <utils.scad>
11
12 coarse = false;
13 enable_head_cups = false;
14
15 main_dia = 71.2 + 0.50 - 2.26;
16 top_thick_middle = 4;
17 top_thick_by_oring = 3.0;
18 top_middle_dr = 11;
19
20 main_cnr = 6.0;
21
22 min_wall = 3;
23
24 rivet_posn = 6.0 + 0.30;
25 rivet_thick = 1.67;
26 rivet_width = 4.15 + 1.0;
27 rivet_tall = 5.51 + 1.49;
28
29 over_rivet_wall = 1.0;
30 side_rivet_gap = 1.5;
31 inside_rivet_gap = 1.5;
32
33 bayo_interf = 0.30;
34 bayo_behind = 8.5;
35 bayo_interf_width = 2.0;
36 bayo_interf_slope = 0.5;
37
38 oring_thick = 5.0;
39 oring_bore = 62.0;
40
41 oring_upper_embed_angle = 80;
42 oring_compress = 0.1; // proportion
43 oring_compress_more = 0.2;
44
45 oring_rm_beside = 8;
46 oring_rm_scale = 2.0;
47 oring_rm_angle = 20;
48
49 side_taper = 1.0;
50
51 bayo_gap = 6.0;
52
53 bayo_entry = 1.167;
54 bayo_inramp = 0.9;
55
56 bayo_slice_size = coarse ? 5 : 1;
57
58 brace_hole_width = 1.0;
59 brace_above_below = 1.2;
60 brace_end_shorter = 0.3;
61
62 jig_thick = 1.4;
63 jig_hole_dia = 3.0;
64 jig_rim = 5;
65 jig_mark = 5;
66
67 strap_loop_thick = 6;
68 strap_loop_inside = 10;
69 strap_loop_strlen = 10;
70 strap_loop_elevation = 45;
71
72 sm_inner_circum = 218 - 1.90 - 1.00 - 0.50;
73 sm_main_thick = 2.0;
74 sm_main_width = 20;
75
76 sm_bolt_dia = 3.5 + 0.1;
77 sm_bolt_shaft = 21.0;
78 sm_bolt_head_dia = 6.94 + 1.0;
79 sm_bolt_head_thick = 2.14;
80 sm_bolt_nut_width = 5.89 + 0.25;
81 sm_bolt_nut_thick = 3.68;
82 sm_bolt_tighten_allow = 2.0;
83
84 sm_bolt_y_clear = 0.75;
85 sm_bolt_y_over = 0.5;
86
87 sm_closure_cnr = 3.0;
88
89 wm_thick = 5;
90 wm_screw_dia = 4.5; // XXX
91 wm_screwdriver_dia = 6.0; // XXX
92 wm_screw_around = 4.0; // XXX
93 wm_screw_slot = 3.5;
94 wm_screw_head = 7.5; // XXX
95
96 wmb_screw_dia = 5;
97 wmb_screw_around = 4; // XXX
98 wmb_screw_depth = 10; // XXX
99 wmb_gap = 1.0;
100
101 catch_stalk_h = 4.5;
102 catch_stalk_len = 50;
103 catch_tip_th = 4;
104 catch_head_th = 3;
105
106 catch_pin_slop = 0.25; // each side, and above
107 catch_pin_slop_x_extra = 0.0; // only on one side
108 catch_stalk_above_gap = 1.5;
109 catch_stalk_eff_bend_rad = catch_stalk_len * 0.75;
110
111 catch_strap_width = 12;
112 catch_stalk_base_width = 15;
113
114 catch_knob_dia = 6;
115 catch_knob_above_gap = 5;
116 catch_knob_height = 3.0;
117
118 catch_stalk_below_gap = 1.0;
119 catch_stalk_beside_gap = 2.0;
120
121 // calculated
122
123 TAU = PI*2;
124
125 bayo_entry_x = bayo_entry;
126 bayo_entry_z = bayo_entry;
127 bayo_inramp_x = bayo_inramp;
128 bayo_inramp_z = bayo_inramp;
129
130 oring_mid_dia = oring_bore + oring_thick;
131 oring_outer_dia = oring_mid_dia + oring_thick;
132
133 oring_oblate = (1 - oring_compress);
134
135 oring_y_rad = oring_thick/2 * oring_oblate;
136 oring_x_rad = oring_thick/2 / oring_oblate;
137
138 by_oring_z = oring_y_rad * (1 + cos(oring_upper_embed_angle));
139
140 side_height = rivet_posn + bayo_behind + rivet_thick/2;
141 side_thick = rivet_tall + over_rivet_wall;
142
143 top_z = top_thick_by_oring + oring_y_rad + by_oring_z;
144
145 middle_bot_z = top_z - top_thick_middle;
146
147 bayo_top_z = bayo_behind + bayo_gap;
148
149 bayo_nom_rad = main_dia/2 + side_thick;
150 bayo_real_rad = main_dia/2 + rivet_tall;
151
152 rivet_entry_width = rivet_width + side_rivet_gap;
153
154 jig_mark_rad = jig_mark + main_dia/2 + jig_thick;
155
156 handling_dia = oring_bore + oring_thick*2 + min_wall*2;
157 handling_angle = 45;
158
159 sm_inner_rad = (sm_inner_circum + sm_bolt_tighten_allow/2) / TAU;
160 sm_outer_rad = sm_inner_rad + sm_main_thick;
161
162 wm_main_width = sm_main_width;
163 wm_y_min = sqrt( pow(sm_inner_rad, 2) -
164                  pow(sm_inner_rad - (wm_thick - sm_main_thick), 2) );
165 wm_y_screw = wm_y_min + wm_screw_around + wm_screw_dia/2;
166 wm_y_max = wm_y_screw + wm_screw_dia/2 + wm_screw_around;
167 wm_y_slotc_screw = wm_y_screw + wm_screw_slot/2;
168 wm_y_slot1_screw = wm_y_screw + wm_screw_slot;
169 wm_y_slot1_max = wm_y_max + wm_screw_slot;
170 wm_z_slot0_screw = wm_main_width + wm_screwdriver_dia/2;
171 wm_z_slotc_screw = wm_z_slot0_screw + wm_screw_slot/2;
172 wm_z_slot1_screw = wm_z_slot0_screw + wm_screw_slot;
173 wm_z_max = wm_z_slot1_screw + wm_screw_around;
174
175 wmb_mount_cut_rad = sm_outer_rad + wmb_gap;
176 wmb_x_screw = -sm_outer_rad + wmb_screw_around + wmb_screw_dia/2;
177 wmb_y_screw_end = sqrt(
178                        pow(wmb_mount_cut_rad, 2) -
179                        pow(wmb_x_screw, 2)
180                        );
181
182 smc_pos = [ 0, sm_inner_rad, 0 ];
183
184 smc_bolt_nut_dia = sm_bolt_nut_width / cos(30);
185 smc_bolt_nut_eff_thick = sm_bolt_nut_thick + sm_bolt_tighten_allow;
186
187 smc_bolt_y = sm_bolt_dia/2 + sm_bolt_y_clear;
188 smc_max_y = smc_bolt_y + sm_bolt_y_over
189   + max(sm_bolt_head_dia/2, smc_bolt_nut_dia/2);
190 smc_cnr_c_x = sm_bolt_shaft/2 - sm_closure_cnr
191   + sm_bolt_head_thick/2 + smc_bolt_nut_eff_thick/2;
192
193 catch_cr = catch_knob_dia/2 + catch_stalk_beside_gap;
194 catch_strap_thick = sm_main_thick;
195
196 echo("R ", sm_inner_rad, bayo_real_rad, bayo_nom_rad);
197
198 $fs= coarse ? 2.5 : 0.5;
199 $fa= coarse ? 5 : 1;
200
201 include <poster-tube-lid-parametric.scad>
202
203 // bayonet definition
204
205 bayo_a = [ bayo_entry_x, 0 ];
206 bayo_p = [ 0, bayo_entry_z ];
207 bayo_n = [ 0, bayo_behind-bayo_inramp_z ];
208 bayo_m = [ bayo_inramp_x, bayo_behind ];
209 bayo_l = bayo_m + bayo_interf * [ 1/bayo_interf_slope,  1 ];
210 bayo_k = bayo_l + [ bayo_interf_width, 0 ];
211 bayo_j = bayo_k + bayo_interf * [ 1/bayo_interf_slope, -1 ];
212 bayo_i = bayo_j + [ rivet_width + inside_rivet_gap, 0 ];
213 bayo_h = [ bayo_i[0], bayo_behind + bayo_gap + bayo_interf ];
214 bayo_g = [ bayo_m[0] - rivet_width, bayo_h[1] ];
215
216 bayo_e = [-bayo_p[0], bayo_p[1]] - [rivet_entry_width,0];
217 bayo_d = [-bayo_a[0], bayo_a[1]] - [rivet_entry_width,0];
218 bayo_c = bayo_d + [0,-5];
219 bayo_b = bayo_a + [0,-5];
220
221 bayo_f = [ bayo_e[0], bayo_g[1] + (bayo_e[0] - bayo_g[0]) ];
222
223 bayo_polygon = [ bayo_a,
224                  bayo_b,
225                  bayo_c,
226                  bayo_d,
227                  bayo_e,
228                  bayo_f,
229                  bayo_g,
230                  bayo_h,
231                  bayo_i,
232                  bayo_j,
233                  bayo_k,
234                  bayo_l,
235                  bayo_m,
236                  bayo_n,
237                  bayo_p ];
238
239 echo(bayo_polygon);
240
241 // CATCH
242
243 cppxC = 0.41 * sm_inner_rad * TAU;
244
245 // catch pin
246
247 cpp_adj = (bayo_n[0] - bayo_f[0]) * (1 - sm_inner_rad / bayo_nom_rad);
248 // radius scaling due to nom and actual radius difference in
249 // bayo entry construction
250
251 cppa = bayo_f + [1,-1] * catch_pin_slop + [1,0] * cpp_adj;
252 cppb = bayo_g + [1,-1] * catch_pin_slop + [1,0] * cpp_adj;
253 cppd = [ bayo_n[0]
254          - catch_pin_slop - catch_pin_slop_x_extra,
255          -catch_stalk_above_gap ];
256 cppi = [ cppa[0], cppd[1] ];
257 cppc = [ cppd[0], cppb[1] ];
258 cpph = cppd + [0,-1] * catch_stalk_h;
259 cppe = cppd + [0,-1] * (catch_knob_above_gap + catch_knob_dia/2);
260 cppf = [ cppa[0], cppe[1] ];
261 cppg = [ cppa[0], cpph[1] ];
262 cppB = 0.5 * (cppf + cppe);
263
264 echo("RR", sm_inner_rad / bayo_nom_rad);
265
266 // catch assembly depression below pin
267
268 cppy6 = cppB[1] - (catch_knob_dia/2
269                    + (cppc[1] - cppd[1])
270                    + catch_stalk_below_gap);
271 cpp7 = [ cppB[0], cppy6 + catch_cr ];
272 cpp11 = cpp7 + [1,0] * catch_cr;
273 cppy9 = cppy6 + catch_strap_width * 1/3;
274 cpp9 = [ cpp7[0] + catch_cr * 2, cppy9 ];
275 cpp8 = cpp9 + [0,-1] * catch_cr;
276 cpp10 = cpp8 + [-1,0] * catch_cr;
277 cppC = [ cppxC, cpp9[1] ];
278 cppD = cppC + [0,-1] * catch_strap_width;
279
280 // catch assembly stalk and so on
281
282 catch_cr3 = catch_cr + catch_stalk_h;
283
284 cppF = [ cppg[0] - catch_stalk_eff_bend_rad, cppd[1] ];
285 cpp4 = [ cppg[0] - catch_stalk_len, cpph[1] ] + [1,-1] * catch_cr;
286 cpp5 = [ cpp4[0], cppC[1] + catch_cr ];
287 cpp2 = cpp5 + [-1,0] * (catch_cr * 2 + catch_stalk_base_width);
288 cpp2r = cpp2 + [1,0] * catch_cr;
289 cpp2d = cpp2 + [0,-1] * catch_cr;
290 cpp3 = [ cpp2[0] + catch_cr + catch_cr3, cppd[1] - catch_cr3 ];
291 cppA = [ -cppxC, cpp9[1] ];
292 cppE = [ cppA[0], cppD[1] ];
293
294 catch_assembly_dy = -cppy9 + catch_strap_width;
295
296
297 module MainProfile(){
298   main_cnr_pos = [ side_thick, top_z ] - [1,1]*main_cnr;
299   difference(){
300     union(){
301       translate(main_cnr_pos){
302         intersection(){
303           difference(){
304             circle(r = main_cnr);
305             circle(r = main_cnr * 0.5);
306           }
307           square([10,10]);
308         }
309       }
310       polygon([[ -top_middle_dr,        middle_bot_z      ],
311                [ -top_middle_dr,        top_z             ],
312                [ main_cnr_pos[0],       top_z             ],
313                [ side_thick,            main_cnr_pos[1]   ],
314                [ side_thick,            -side_height      ],
315                [ side_taper,            -side_height      ],
316                [ 0,                     -rivet_posn       ],
317                [ 0,                     by_oring_z        ],
318                [ -oring_x_rad,          by_oring_z        ],
319                ],
320               convexity=10);
321     }
322     translate([ oring_mid_dia/2 - main_dia/2, 0 ])
323       hull(){
324       translate([ 0, oring_y_rad ])
325         scale([ 1/oring_oblate * (oring_compress_more+1) , oring_oblate ])
326         circle(oring_thick/2);
327       translate([ 0, oring_y_rad*2 - oring_thick/2 ])
328         circle(oring_thick/2);
329     }
330   }
331 }
332
333 module StrapLoopProfile(){
334   circle(r = strap_loop_thick/2);
335 }
336
337 module StrapLoop(){ ////toplevel
338   bigrad = strap_loop_inside/2 + strap_loop_thick/2;
339   extralen = strap_loop_thick * 5;
340
341   intersection(){
342     rotate([strap_loop_elevation, 0,0]){
343       for (x= [ -1, +1 ] * bigrad) {
344         translate([x, -extralen, 0])
345           rotate([-90,0,0])
346           linear_extrude(height= extralen + strap_loop_strlen + 0.1,
347                          convexity=10)
348           StrapLoopProfile();
349       }
350       translate([0, strap_loop_strlen, 0]){
351         intersection(){
352           rotate_extrude(convexity=10)
353             translate([bigrad, 0,0])
354             StrapLoopProfile();
355           translate([0,50,0])
356             cube([100,100,100], center=true);
357         }
358       }
359     }
360     translate([0, 50, 0])
361       cube(100, center=true);
362   }
363 }
364
365 module RotateProjectSlice(offset, slice_size, nom_rad, real_rad){
366   // nom_rad > real_rad
367   rotate([0,0, atan2(offset, nom_rad) ]){
368     intersection(){
369       translate([-offset, -10, 0])
370         rotate([90,0,0])
371         linear_extrude(height= nom_rad*2, convexity=50)
372         children(0);
373       translate([0,0, -25])
374         cylinder(h=50, r= real_rad);
375       translate([0,0, -25])
376         linear_extrude(height= 50, convexity=50)
377         polygon([ [ 0,0 ],
378                   [ -slice_size, -real_rad*2 ],
379                   [ +slice_size, -real_rad*2 ] ]);
380     }
381   }
382 }
383
384 module RotateProject(x_min, x_max, slice_size, nom_rad, real_rad){
385   offs = [ for (i=[ x_min :
386                     slice_size :
387                     x_max + slice_size ]) i ];
388   echo (offs);
389   for (off=offs)
390     RotateProjectSlice(off, slice_size, nom_rad, real_rad)
391     children(0);
392 }
393
394 module BayonetCutout(){
395   RotateProject(bayo_c[0], bayo_i[0], bayo_slice_size,
396                 bayo_nom_rad, 
397                 bayo_real_rad)
398     translate([-0.5 * (bayo_a[0] + bayo_d[0]), 0])
399     polygon(bayo_polygon, convexity=10);
400 }
401
402 module ProfilesDemo(){ ////toplevel
403   translate([-10,0]) MainProfile();
404   translate([+10, -side_height]) polygon(bayo_polygon, convexity=10);
405 }
406
407 module LimitForHandling(){ ////toplevel
408   hull() for (r=[0,180])
409     rotate([0,0,r]) {
410       for (rs=[-1,+1]) {
411         for (xd=[0,1]) {
412           rotate([0,0, rs * handling_angle/2]) {
413             translate([rs * xd * main_dia/2 * tan(handling_angle/2),
414                        main_dia/2 + side_thick - main_cnr,
415                        top_z - main_cnr]) {
416               mirror([0,0,1])
417                 cylinder(r= main_cnr, h=50);
418               sphere(main_cnr);
419             }
420           }
421         }
422       } 
423     }
424   hull() rotate_extrude(convexity=10){
425     translate([ handling_dia/2 - main_cnr, top_z - main_cnr ]) {
426       circle(r = main_cnr);
427       mirror([0,1]) square([ main_cnr, 50 ]);
428     }
429   }
430   //cylinder(r= handling_dia/2, h=20);
431 }
432
433 module Cover(){ ////toplevel
434   render() difference(){
435     intersection(){
436       union(){
437         rotate_extrude(convexity=10)
438           translate([main_dia/2, 0])
439           MainProfile();
440         translate([0,0, middle_bot_z])
441           cylinder(h= top_thick_middle, r = main_dia/2 - top_middle_dr + 1);
442       }
443       LimitForHandling();
444     }
445     for (r=[0,180]){
446       rotate([0,0, r])
447         translate([0,0, -side_height])
448         BayonetCutout();
449       rotate([0,0, r + asin((-oring_rm_beside) / (main_dia/2))])
450         translate([0,
451                    oring_mid_dia/2 + oring_thick/4 * oring_rm_scale,
452                    oring_y_rad * 1.5])
453         rotate([-oring_rm_angle, 0, 0])
454         mirror([0,0,1])
455         cylinder(r = oring_thick/4 * oring_rm_scale, h=20);
456     }
457     for (r=[0 : 60 : 179]) {
458       rotate([0,0, r]) {
459         height = top_thick_middle - brace_above_below*2;
460         translate([0,0, middle_bot_z + brace_above_below + height/2 ])
461         cube(center=true, [ oring_bore - brace_end_shorter,
462                             brace_hole_width, height ]);
463       }
464     }
465   }
466   if (enable_head_cups)
467     for (r=[0,180])
468       rotate([0,0,r])
469         translate([-implheadcup_large_dia * .5 - implheadcup_thick/2,
470                    -implheadcup_large_dia * .0,
471                    middle_bot_z + 0.1])
472         ImplHeadCup();
473
474 //  translate(strap_loop_thick * [-0.5, 0, +1])
475 //    translate([handling_dia/2, 0, -side_height])
476 //    rotate([0,180,0]) rotate([0,0,90])
477 //    StrapLoop();
478 }
479
480 module SavingHole(){
481   translate([0,0, -10])
482     cylinder(r= main_dia/2 - jig_rim, h=20);
483 }
484
485 module Jig(){ ////toplevel
486   difference(){
487     union(){
488       translate([0,0, -side_height]){
489         cylinder(r= main_dia/2 + jig_thick, h= side_height + jig_thick);
490       }
491       translate([-jig_mark_rad, 0, jig_thick - jig_mark])
492         cube([jig_mark_rad*2, jig_mark, jig_mark]);
493     }
494     translate([0,0, -side_height-1])
495       cylinder(r= main_dia/2, h= side_height + 1);
496     SavingHole();
497     translate([0,0, -rivet_posn])
498       rotate([90, 0,0])
499       translate([0,0, -100])
500       cylinder(r= jig_hole_dia/2, h = 200);
501   }
502 }
503
504 module CoverPrint(){ ////toplevel
505   rotate([0,180,0]) Cover();
506 }
507
508 module CoverTest2(){ ////toplevel
509   difference(){
510     Cover();
511     SavingHole();
512   }
513 }
514
515 module CoverTest1(){ ////toplevel
516   difference(){
517     CoverTest2();
518     difference(){
519       for (r= [ 40, 147 ]){
520         rotate([0,0, r]){
521           translate([0,0, -10]) {
522             cube([ main_dia*3, main_dia * .53, 18], center=true);
523           }
524         }
525       }
526 //      translate([ 50, 0, 0 ])
527 //      cube([ 100,
528 //             strap_loop_inside + strap_loop_thick*2 + 1,
529 //             100 ],
530 //           center=true);
531     }
532   }
533 }
534
535 module ImplHeadCupTest(){ ////toplevel
536   for (r=[0,180])
537     rotate([0,0,r])
538       translate([-17,0,0])
539       ImplHeadCup();
540 }
541
542 module SomeStrap(width, cut_width=0){
543   // children(0) is to add, (1) subtract
544   difference(){
545     union(){
546       cylinder(r=sm_outer_rad, h=width);
547       StrapMountProtrusion(smc_cnr_c_x + sm_closure_cnr,
548                            smc_max_y,
549                            sm_closure_cnr,
550                            width);
551       children(0);
552     }
553     translate([0,0,-1])
554       cylinder(r=sm_inner_rad, h=max(width+2, cut_width));
555     translate(smc_pos)
556       StrapMountBolt(10, width);
557     translate(smc_pos)
558       cube([ sm_bolt_tighten_allow, 40,100 ], center=true);
559     children(1);
560   }
561 }
562
563 module StrapMountBolt(l_delta, strap_width){ ///toplevel
564   // positioned relative to smc_pos
565   translate([(smc_bolt_nut_eff_thick - sm_bolt_head_thick)/2,
566              smc_bolt_y,
567              strap_width/2]){
568     translate([ -sm_bolt_shaft/2-1, 0,0 ]){
569       rotate([0,90,0]) cylinder(r= sm_bolt_dia/2, h= sm_bolt_shaft+2);
570     }
571     translate([ -sm_bolt_shaft/2, 0,0 ])
572       rotate([0,-90,0])
573       cylinder($fn=6, r=smc_bolt_nut_dia/2,
574                h=smc_bolt_nut_eff_thick + l_delta);
575     translate([ sm_bolt_shaft/2, 0,0 ])
576       rotate([0,90,0])
577       cylinder(r=sm_bolt_head_dia/2, h=sm_bolt_head_thick + l_delta);
578   }
579 }
580
581 module StrapMountProtrusion(half_x, max_y, cnr, width){
582   translate(smc_pos){
583     linear_extrude(height=width, convexity=10){
584       hull(){
585         for (m = [0,1]) mirror([m,0,0]) {
586           translate([-(half_x - cnr), max_y - cnr])
587             circle(r=cnr);
588           translate([-half_x, -sm_inner_rad])
589             square([1,1]);
590         }
591       }
592     }
593   }
594 }
595
596 module StrapMount(){ ////toplevel
597   SomeStrap(sm_main_width){
598     rotate([0,0,180]){
599       StrapMountProtrusion(strap_loop_inside/2 + strap_loop_thick,
600                            strap_loop_thick,
601                            sm_closure_cnr,
602                            sm_main_width);
603       translate(smc_pos +
604                 [0,0, sm_main_width] +
605                 strap_loop_thick * [ 0, 0.5, -1.0 ])
606         StrapLoop();
607     }
608     union(){ };
609   }
610 }
611
612 module WallScrewHoleSlot(){ ////toplevel
613   ds = [-1,+1] * wm_screw_slot/2;
614   linextr_x_yz(-(wm_thick + 1), 1) {
615     hull(){
616       for (d = ds)
617         translate([d, 0])
618           circle(r = wm_screw_dia/2);
619     }
620   }
621   hull(){
622     for (d = ds){
623       translate([0, d, 0]){
624         linextr_x_yz(0, 1)
625           circle(r = wm_screw_head/2);
626         linextr_x_yz(-(wm_screw_head - wm_screw_dia)/2, 0)
627           circle(r = wm_screw_dia/2);
628       }
629     }
630   }
631 }
632
633 module WallMountMounts(){
634   linextr(0, wm_z_max){
635     translate([ -sm_outer_rad, 0 ])
636       rectfromto([ 0, -wm_y_max ],
637                  [ wm_thick, wm_y_slot1_max ]);
638   }
639 }
640 module WallMountScrewHoles(){
641   translate([ -sm_outer_rad + wm_thick, 0, wm_z_slotc_screw]) {
642     translate([ 0, wm_y_slotc_screw, 0 ])
643       WallScrewHoleSlot();
644     translate([ 0, -wm_y_slotc_screw, 0 ])
645       rotate([90,0,0])
646       WallScrewHoleSlot();
647   }
648 }
649
650 module WallMount(){ ////toplevel
651   SomeStrap(sm_main_width, wm_z_max + 2){
652     WallMountMounts();
653     WallMountScrewHoles();
654   }
655 }
656
657 module WallMountBaseMounts(){
658   linextr(0, 20) {
659     difference(){
660       translate([ wmb_x_screw, wmb_y_screw_end ])
661         rotate(45)
662         square(10, center=true);
663       circle(r = wmb_mount_cut_rad);
664     }
665   }
666 }
667
668 module WallMountForBase(){ ////toplevel
669   SomeStrap(sm_main_width, wm_z_max + 2){
670     union(){
671       WallMountMounts();
672       WallMountBaseMounts();
673     }
674     union(){
675       WallMountScrewHoles();
676     }
677   }
678 }
679
680 module CatchAssemblyCoreProfile(){
681   difference(){
682     union(){
683       hull(){
684         translate(cpp3) circle(r= catch_cr3);
685         polygon([ cpp3,
686                   cpp2r,
687                   cpp5,
688                   cpph,
689                   cppd
690                   ]);
691       }
692       polygon([cppD,
693                cppC,
694                cpp9,
695                cpp10,
696                cpp11,
697                cpp4,
698                cpp2r,
699                cpp2d,
700                cppA,
701                cppE
702                ]);
703       translate(cpp8) circle(r= catch_cr);
704     }
705     hull(){
706       translate(cpp4) circle(r= catch_cr);
707       translate(cpp5) circle(r= catch_cr);
708       translate(cpp7) circle(r= catch_cr);
709       polygon([cpp4,
710                cppg,
711                cpph,
712                cpp10,
713                cpp11,
714                ]);
715     }
716     translate(cpp2) circle(r= catch_cr);
717   }
718   // if cpp11 is above cpp10, the subtracted hull above
719   // can go down too far.  Ensure we do not cut off below cppy6.
720   polygon([ cppE,
721             cppD,
722             cpp9,
723             [ cpp9[0],            cppy6 ],
724             [ cpp7[0] - catch_cr, cppy6 ],
725             cpp2d
726             ]);
727 }
728
729 module CatchTipProfile(dy){
730   ddy = [0,dy];
731   intersection(){
732     translate(cppF){
733       difference(){
734 //      circle(r = dist2d(cppF, cppd));
735         //circle(r = dist2d(cppF, cppa));
736       }
737     }
738     polygon([ cppa,
739               cppi + ddy,
740               cppd + ddy,
741               cppc,
742               cppb ]);
743   }
744 }
745
746 module CatchHeadProfile(){
747   polygon([ cppd,
748             cppd,
749             cppi,
750             cppf,
751             cppe,
752             cpph ]);
753 }
754
755
756 module CatchCore(){ /////toplevel
757   linear_extrude(height=catch_strap_thick, convexity=10)
758     CatchAssemblyCoreProfile();
759
760   hull(){
761     linear_extrude(height=catch_head_th, convexity=10)
762       CatchTipProfile(0);
763     linear_extrude(height=catch_tip_th, convexity=10)
764       CatchTipProfile(catch_tip_th - catch_head_th);
765   }
766
767   linear_extrude(height=catch_head_th, convexity=10)
768     CatchHeadProfile();
769
770   translate(concat(cppB,[0])) hull(){
771     translate([0,0, catch_knob_height + catch_head_th - catch_knob_dia/2])
772       sphere(r = catch_knob_dia/2);
773     cylinder(r = catch_knob_dia/2, h = 0.1);
774   }
775 }
776
777 module CatchPreDistort(){ /////toplevel
778   scale(100 / sm_inner_rad)
779     rotate([90,0,0])
780     CatchCore();
781 }
782
783 module CatchAssembly(){ /////toplevel
784   rotate([0,0, -(cppe[0] + cppB[0] + catch_pin_slop) / sm_inner_rad * 360/TAU])
785     translate([0,0, catch_assembly_dy])
786     scale(sm_inner_rad / 100)
787     import(str("poster-tube-lid,CatchPostDistort-fa",
788                (coarse ? 20 : 3),
789                ".stl"),
790            convexity=20);
791
792   SomeStrap(catch_strap_width){
793     union(){ }
794     union(){
795       translate([-200, -200, -200])
796         cube([400, 200, 400]);
797     }
798   }
799 }
800
801 module CatchDemo(){ /////toplevel
802   color("blue") translate([0,0,
803                            -catch_assembly_dy
804              ])
805     CatchAssembly();
806   translate([0,0,+side_height
807              ])
808     Cover();
809 }
810
811 module CatchDemoS(){ /////toplevel
812   color("blue") translate([0,0,
813              -catch_assembly_dy
814              ])
815     CatchAssembly();
816   intersection(){
817     translate([0,0,+side_height
818                ])
819       Cover();
820     mirror([0,1,0]) translate([-250,33,0]) cube([500,500,500]);
821   }
822   color("black")
823     translate([0,-33,0])
824     cube([6.15, 2,2], center=true);
825 }
826
827 module CatchPinProfileDemo(){ /////toplevel
828   translate([0, 0 * -bayo_behind,0]) {
829     echo("G ",
830          bayo_n[0] - bayo_e[0]);
831     color("blue") translate([0,0,
832                              +1,
833                ]) {
834       CatchAssemblyCoreProfile();
835       CatchHeadProfile();
836     }
837     translate([0,0,10])
838       color("red")
839       CatchTipProfile(0);
840
841     polygon(bayo_polygon, convexity=10);
842
843     // adhoc show a position
844     color("purple")
845     translate(concat(
846                      cppa,
847                      10
848                      )) difference(){ circle(2.5); circle(2.0); }
849
850  }
851 }
852
853 //ProfilesDemo();
854 //BayonetCutout();
855 //MainProfile();
856 //Cover();
857 //Jig();
858 //CoverTest();