chiark / gitweb /
sleepphone-cable-box: wip, keeper, etc.
[reprap-play.git] / poster-tube-lid.scad
index c5899d34afa7e6bb63c742405f8c0da1ef4eba48..81120a4a74258a76c7528c65894b9dff9d760762 100644 (file)
 // -*- C -*-
 
-main_dia = 71.2 + 0.50;
-top_thick = 4;
+coarse = false;
 
-main_cnr = 4.0;
+main_dia = 71.2 + 0.50 - 2.26;
+top_thick_middle = 4;
+top_thick_by_oring = 3.0;
+top_middle_dr = 11;
 
-rivet_posn = 6.0;
+main_cnr = 6.0;
+
+min_wall = 3;
+
+rivet_posn = 6.0 + 0.30;
 rivet_thick = 1.67;
 rivet_width = 4.15 + 1.0;
-rivet_tall = 5.51 + 0.49;
+rivet_tall = 5.51 + 1.49;
 
-over_rivet_wall = 0.5;
+over_rivet_wall = 1.0;
 side_rivet_gap = 1.5;
+inside_rivet_gap = 1.5;
 
-bayo_interf = 0.75;
+bayo_interf = 0.30;
 bayo_behind = 3.5;
 bayo_interf_width = 2.0;
-bayo_interf_slope = 0.75;
+bayo_interf_slope = 0.5;
+
+oring_thick = 5.0;
+oring_bore = 62.0;
 
-seal_thick = 0.1;
-seal_recess = [ 2.0, 2.0 ]; // recess depth, recess height
+oring_upper_embed_angle = 80;
+oring_compress = 0.1; // proportion
+oring_compress_more = 0.2;
+
+oring_rm_beside = 8;
+oring_rm_scale = 2.0;
+oring_rm_angle = 20;
 
 side_taper = 1.0;
 
-bayo_above_gap = 1.0;
+bayo_gap = 6.0;
 
 bayo_entry = bayo_behind/3;
 
-bayo_slice_size = 1;
+bayo_slice_size = coarse ? 5 : 1;
 
 brace_hole_width = 1.0;
-brace_above_below = 0.5;
+brace_above_below = 1.2;
+brace_end_shorter = 0.3;
+
+jig_thick = 1.4;
+jig_hole_dia = 3.0;
+jig_rim = 5;
+jig_mark = 5;
+
+strap_hoop_thick = 6;
+strap_hoop_inside = 10;
+strap_hoop_strlen = 10;
+strap_hoop_elevation = 45;
+
+sm_inner_circum = 218 - 1.90 - 1.00 - 0.50;
+sm_main_thick = 2.0;
+sm_main_width = 20;
+
+sm_bolt_dia = 3.5 + 0.1;
+sm_bolt_shaft = 21.9;
+sm_bolt_head_dia = 6.94 + 1.0;
+sm_bolt_head_thick = 2.14;
+sm_bolt_nut_width = 5.89 + 0.25;
+sm_bolt_nut_thick = 3.68;
+sm_bolt_tighten_allow = 2.0;
+
+sm_bolt_y_clear = 0.75;
+sm_bolt_y_over = 0.5;
+
+sm_closure_cnr = 3.0;
 
 // calculated
 
+TAU = PI*2;
+
 bayo_entry_x = bayo_entry;
 bayo_entry_z = bayo_entry;
 bayo_inramp_x = bayo_entry;
 bayo_inramp_z = bayo_entry;
 
+oring_mid_dia = oring_bore + oring_thick;
+oring_outer_dia = oring_mid_dia + oring_thick;
+
+oring_oblate = (1 - oring_compress);
+
+oring_y_rad = oring_thick/2 * oring_oblate;
+oring_x_rad = oring_thick/2 / oring_oblate;
+
+by_oring_z = oring_y_rad * (1 + cos(oring_upper_embed_angle));
+
 side_height = rivet_posn + bayo_behind + rivet_thick/2;
 side_thick = rivet_tall + over_rivet_wall;
 
-top_z = top_thick + seal_thick;
+top_z = top_thick_by_oring + oring_y_rad + by_oring_z;
+
+middle_bot_z = top_z - top_thick_middle;
 
 bayo_entry = bayo_behind / 3.0;
-bayo_top_z = bayo_behind + rivet_thick + bayo_above_gap;
-bayo_entry_ramp = bayo_entry + bayo_interf;
+bayo_top_z = bayo_behind + bayo_gap;
 
 rivet_entry_width = rivet_width + side_rivet_gap;
 
-$fs=0.5;
-$fa=1;
+jig_mark_rad = jig_mark + main_dia/2 + jig_thick;
+
+handling_dia = oring_bore + oring_thick*2 + min_wall*2;
+handling_angle = 45;
+
+sm_inner_rad = (sm_inner_circum + sm_bolt_tighten_allow/2) / TAU;
+sm_outer_rad = sm_inner_rad + sm_main_thick;
+
+smc_pos = [ 0, sm_inner_rad, 0 ];
+
+smc_bolt_nut_dia = sm_bolt_nut_width / cos(30);
+smc_bolt_nut_eff_thick = sm_bolt_nut_thick + sm_bolt_tighten_allow;
+
+smc_bolt_y = sm_bolt_dia/2 + sm_bolt_y_clear;
+smc_max_y = smc_bolt_y + sm_bolt_y_over
+  + max(sm_bolt_head_dia/2, smc_bolt_nut_dia/2);
+smc_cnr_c_x = sm_bolt_shaft/2 - sm_closure_cnr
+  + sm_bolt_head_thick/2 + smc_bolt_nut_eff_thick/2;
+
+$fs= coarse ? 2.5 : 0.5;
+$fa= coarse ? 5 : 1;
+
+include <poster-tube-lid-parametric.scad>
 
 // bayonet definition
 
@@ -62,8 +139,8 @@ bayo_m = [ bayo_inramp_x, bayo_behind ];
 bayo_l = bayo_m + bayo_interf * [ 1/bayo_interf_slope,  1 ];
 bayo_k = bayo_l + [ bayo_interf_width, 0 ];
 bayo_j = bayo_k + bayo_interf * [ 1/bayo_interf_slope, -1 ];
-bayo_i = bayo_j + [ rivet_width, 0 ];
-bayo_h = [ bayo_i[0], bayo_behind + rivet_thick + bayo_above_gap ];
+bayo_i = bayo_j + [ rivet_width + inside_rivet_gap, 0 ];
+bayo_h = [ bayo_i[0], bayo_behind + bayo_gap + bayo_interf ];
 bayo_g = [ bayo_m[0] - rivet_width, bayo_h[1] ];
 
 bayo_e = [-bayo_p[0], bayo_p[1]] - [rivet_entry_width,0];
@@ -93,26 +170,74 @@ echo(bayo_polygon);
 
 module MainProfile(){
   main_cnr_pos = [ side_thick, top_z ] - [1,1]*main_cnr;
-  translate(main_cnr_pos){
-    intersection(){
-      difference(){
-       circle(r = main_cnr);
-       circle(r = main_cnr * 0.5);
+  difference(){
+    union(){
+      translate(main_cnr_pos){
+       intersection(){
+         difference(){
+           circle(r = main_cnr);
+           circle(r = main_cnr * 0.5);
+         }
+         square([10,10]);
+       }
       }
-      square([10,10]);
+      polygon([[ -top_middle_dr,        middle_bot_z      ],
+              [ -top_middle_dr,        top_z             ],
+              [ main_cnr_pos[0],       top_z             ],
+              [ side_thick,            main_cnr_pos[1]   ],
+              [ side_thick,            -side_height      ],
+              [ side_taper,            -side_height      ],
+              [ 0,                     -rivet_posn       ],
+              [ 0,                     by_oring_z        ],
+              [ -oring_x_rad,          by_oring_z        ],
+              ],
+             convexity=10);
+    }
+    translate([ oring_mid_dia/2 - main_dia/2, 0 ])
+      hull(){
+      translate([ 0, oring_y_rad ])
+       scale([ 1/oring_oblate * (oring_compress_more+1) , oring_oblate ])
+       circle(oring_thick/2);
+      translate([ 0, oring_y_rad*2 - oring_thick/2 ])
+       circle(oring_thick/2);
     }
   }
-  polygon([[ -1,                    seal_thick        ],
-          [ -1,                    top_z             ],
-          [ main_cnr_pos[0],       top_z             ],
-          [ side_thick,            main_cnr_pos[1]   ],
-          [ side_thick,            -side_height      ],
-          [ side_taper,            -side_height      ],
-          [ 0,                     -rivet_posn       ],
-          [ 0,                     -(seal_recess[0] + seal_recess[1]) ],
-          [ seal_recess[0],        -(seal_recess[0]) ],
-          [ seal_recess[0],        seal_thick        ],
-          ]);
+}
+
+module StrapHoopProfile(){
+  circle(r = strap_hoop_thick/2);
+}
+
+module StrapHoop(){ ////toplevel
+  bigrad = strap_hoop_inside/2 + strap_hoop_thick/2;
+  extralen = strap_hoop_thick * 5;
+
+  intersection(){
+    rotate([strap_hoop_elevation, 0,0]){
+      for (x= [ -1, +1 ] * bigrad) {
+       translate([x, -extralen, 0])
+         rotate([-90,0,0])
+         linear_extrude(height= extralen + strap_hoop_strlen + 0.1,
+                        convexity=10)
+         StrapHoopProfile();
+      }
+      translate([0, strap_hoop_strlen, 0]){
+       intersection(){
+         rotate_extrude(convexity=10)
+           translate([bigrad, 0,0])
+           StrapHoopProfile();
+         translate([0,50,0])
+           cube([100,100,100], center=true);
+       }
+      }
+    }
+    translate([0, 50, 0])
+      cube(100, center=true);
+  }
+}
+
+module HandlingProfile(){
+//  translate([
 }
 
 module RotateProjectSlice(offset, slice_size, nom_rad, real_rad){
@@ -148,38 +273,206 @@ module BayonetCutout(){
   RotateProject(bayo_c[0], bayo_i[0], bayo_slice_size,
                main_dia/2 + side_thick, 
                main_dia/2 + rivet_tall)
-    polygon(bayo_polygon);
+    translate([-0.5 * (bayo_a[0] + bayo_d[0]), 0])
+    polygon(bayo_polygon, convexity=10);
 }
 
-module ProfilesDemo(){
-  translate([-20,0]) MainProfile();
-  polygon(bayo_polygon);
+module ProfilesDemo(){ ////toplevel
+  translate([-10,0]) MainProfile();
+  translate([+10, -side_height]) polygon(bayo_polygon, convexity=10);
 }
 
-module Cover(){
-  difference(){
-    union(){
-      rotate_extrude()
-       translate([main_dia/2, 0])
-       MainProfile();
-      translate([0,0, seal_thick])
-       cylinder(h= top_thick, r = main_dia/2);
+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 ]);
     }
-    for (r=[0,180])
+  }
+  //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 - brace_above_below*2;
-       translate([0,0, seal_thick + brace_above_below + height/2 ])
-       cube(center=true, [ main_dia, brace_hole_width, height ]);
+       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);
   }
 }
 
 //ProfilesDemo();
 //BayonetCutout();
 //MainProfile();
-Cover();
+//Cover();
+//Jig();
+//CoverTest();