+module HandlingProfile(){
+// translate([
+}
+
+module RotateProjectSlice(offset, slice_size, nom_rad, real_rad){
+ // nom_rad > real_rad
+ rotate([0,0, atan2(offset, nom_rad) ]){
+ intersection(){
+ translate([-offset, -10, 0])
+ rotate([90,0,0])
+ linear_extrude(height= nom_rad*2)
+ children(0);
+ translate([0,0, -25])
+ cylinder(h=50, r= real_rad);
+ translate([0,0, -25])
+ linear_extrude(height= 50)
+ polygon([ [ 0,0 ],
+ [ -slice_size, -real_rad*2 ],
+ [ +slice_size, -real_rad*2 ] ]);
+ }
+ }
+}
+
+module RotateProject(x_min, x_max, slice_size, nom_rad, real_rad){
+ offs = [ for (i=[ x_min :
+ slice_size :
+ x_max + slice_size ]) i ];
+ echo (offs);
+ for (off=offs)
+ RotateProjectSlice(off, slice_size, nom_rad, real_rad)
+ children(0);
+}
+
+module BayonetCutout(){
+ RotateProject(bayo_c[0], bayo_i[0], bayo_slice_size,
+ main_dia/2 + side_thick,
+ main_dia/2 + rivet_tall)
+ translate([-0.5 * (bayo_a[0] + bayo_d[0]), 0])
+ polygon(bayo_polygon, convexity=10);
+}
+
+module ProfilesDemo(){ ////toplevel
+ translate([-10,0]) MainProfile();
+ translate([+10, -side_height]) polygon(bayo_polygon, convexity=10);
+}
+
+module LimitForHandling(){ ////toplevel
+ hull() for (r=[0,180])
+ rotate([0,0,r]) {
+ for (rs=[-1,+1]) {
+ for (xd=[0,1]) {
+ rotate([0,0, rs * handling_angle/2]) {
+ translate([rs * xd * main_dia/2 * tan(handling_angle/2),
+ main_dia/2 + side_thick - main_cnr,
+ top_z - main_cnr]) {
+ mirror([0,0,1])
+ cylinder(r= main_cnr, h=50);
+ sphere(main_cnr);
+ }
+ }
+ }
+ }
+ }
+ hull() rotate_extrude(){
+ translate([ handling_dia/2 - main_cnr, top_z - main_cnr ]) {
+ circle(r = main_cnr);
+ mirror([0,1]) square([ main_cnr, 50 ]);
+ }
+ }
+ //cylinder(r= handling_dia/2, h=20);
+}
+
+module Cover(){ ////toplevel
+ render() difference(){
+ intersection(){
+ union(){
+ rotate_extrude(convexity=10)
+ translate([main_dia/2, 0])
+ MainProfile();
+ translate([0,0, middle_bot_z])
+ cylinder(h= top_thick_middle, r = main_dia/2 - top_middle_dr + 1);
+ }
+ LimitForHandling();
+ }
+ for (r=[0,180]){
+ rotate([0,0, r])
+ translate([0,0, -side_height])
+ BayonetCutout();
+ rotate([0,0, r + asin((-oring_rm_beside) / (main_dia/2))])
+ translate([0,
+ oring_mid_dia/2 + oring_thick/4 * oring_rm_scale,
+ oring_y_rad * 1.5])
+ rotate([-oring_rm_angle, 0, 0])
+ mirror([0,0,1])
+ cylinder(r = oring_thick/4 * oring_rm_scale, h=20);
+ }
+ for (r=[0 : 60 : 179]) {
+ rotate([0,0, r]) {
+ height = top_thick_middle - brace_above_below*2;
+ translate([0,0, middle_bot_z + brace_above_below + height/2 ])
+ cube(center=true, [ oring_bore - brace_end_shorter,
+ brace_hole_width, height ]);
+ }
+ }
+ }
+ for (r=[0,180])
+ rotate([0,0,r])
+ translate([-implheadcup_large_dia * .5 - implheadcup_thick/2,
+ -implheadcup_large_dia * .0,
+ middle_bot_z + 0.1])
+ ImplHeadCup();
+// translate(strap_hoop_thick * [-0.5, 0, +1])
+// translate([handling_dia/2, 0, -side_height])
+// rotate([0,180,0]) rotate([0,0,90])
+// StrapHoop();
+}
+
+module SavingHole(){
+ translate([0,0, -10])
+ cylinder(r= main_dia/2 - jig_rim, h=20);
+}
+
+module Jig(){ ////toplevel
+ difference(){
+ union(){
+ translate([0,0, -side_height]){
+ cylinder(r= main_dia/2 + jig_thick, h= side_height + jig_thick);
+ }
+ translate([-jig_mark_rad, 0, jig_thick - jig_mark])
+ cube([jig_mark_rad*2, jig_mark, jig_mark]);
+ }
+ translate([0,0, -side_height-1])
+ cylinder(r= main_dia/2, h= side_height + 1);
+ SavingHole();
+ translate([0,0, -rivet_posn])
+ rotate([90, 0,0])
+ translate([0,0, -100])
+ cylinder(r= jig_hole_dia/2, h = 200);
+ }
+}
+
+module CoverTest2(){ ////toplevel
+ difference(){
+ Cover();
+ SavingHole();
+ }
+}
+
+module CoverTest1(){ ////toplevel
+ difference(){
+ CoverTest2();
+ difference(){
+ for (r= [ 40, 147 ]){
+ rotate([0,0, r]){
+ translate([0,0, -10]) {
+ cube([ main_dia*3, main_dia * .53, 18], center=true);
+ }
+ }
+ }
+// translate([ 50, 0, 0 ])
+// cube([ 100,
+// strap_hoop_inside + strap_hoop_thick*2 + 1,
+// 100 ],
+// center=true);
+ }
+ }
+}
+
+module ImplHeadCupTest(){ ////toplevel
+ for (r=[0,180])
+ rotate([0,0,r])
+ translate([-17,0,0])
+ ImplHeadCup();
+}
+
+module StrapMountBolt(l_delta){ ///toplevel
+ // positioned relative to smc_pos
+ translate([(smc_bolt_nut_eff_thick - sm_bolt_head_thick)/2,
+ smc_bolt_y,
+ sm_main_width/2]){
+ translate([ -sm_bolt_shaft/2-1, 0,0 ]){
+ rotate([0,90,0]) cylinder(r= sm_bolt_dia/2, h= sm_bolt_shaft+2);
+ }
+ translate([ -sm_bolt_shaft/2, 0,0 ])
+ rotate([0,-90,0])
+ cylinder($fn=6, r=smc_bolt_nut_dia/2,
+ h=smc_bolt_nut_eff_thick + l_delta);
+ translate([ sm_bolt_shaft/2, 0,0 ])
+ rotate([0,90,0])
+ cylinder(r=sm_bolt_head_dia/2, h=sm_bolt_head_thick + l_delta);
+ }
+}
+
+module StrapMountProtrusion(half_x, max_y, cnr){
+ translate(smc_pos){
+ linear_extrude(height=sm_main_width, convexity=10){
+ hull(){
+ for (m = [0,1]) mirror([m,0,0]) {
+ translate([-(half_x - cnr), max_y - cnr])
+ circle(r=cnr);
+ translate([-half_x, -sm_inner_rad])
+ square([1,1]);
+ }
+ }
+ }
+ }
+}
+
+module StrapMount(){ ////toplevel
+ difference(){
+ union(){
+ cylinder(r=sm_outer_rad, h=sm_main_width);
+ StrapMountProtrusion(smc_cnr_c_x + sm_closure_cnr,
+ smc_max_y,
+ sm_closure_cnr);
+ rotate([0,0,180]){
+ StrapMountProtrusion(strap_hoop_inside/2 + strap_hoop_thick,
+ strap_hoop_thick,
+ sm_closure_cnr);
+ translate(smc_pos +
+ [0,0, sm_main_width] +
+ strap_hoop_thick * [ 0, 0.5, -1.0 ])
+ StrapHoop();
+ }
+ }
+ translate([0,0,-1])
+ cylinder(r=sm_inner_rad, h=sm_main_width+2);
+ translate(smc_pos)
+ StrapMountBolt(10);
+ translate(smc_pos)
+ cube([ sm_bolt_tighten_allow, 40,100 ], center=true);
+ }