chiark / gitweb /
powerbank-bike-clamp: fix to reduce size below bolt
[reprap-play.git] / powerbank-bike-clamp.scad
index 076538b14795904ddc9d899f51726abcb0928905..01b5ebef502ed12fe7ee34c93a713acb6bb57e21 100644 (file)
@@ -1,5 +1,9 @@
 // -*- C -*-
 
+// Print one of each:
+//    Main
+//    TubeClampRight
+
 include <utils.scad>
 
 tube_dia = 22.4;
@@ -17,7 +21,7 @@ screw_nut_th = 3.9 + 0.75;
 knob_behind_across = 12.2 + 0.75;
 behind_knob_th = 5;
 
-clamp_width = 20;
+clamp_min_width = 20;
 
 clamp_gap = 2;
 
@@ -27,7 +31,7 @@ overlap_l = 0.1;
 
 bridge_slop = 1.2;
 
-hinge_lobes = 2;
+hinge_lobe_per = 10;
 hinge_gap_z = 0.75;
 hinge_gap_xy = 0.75;
 
@@ -37,11 +41,12 @@ $fa = 5;
 bank_eps_bbox_x = [149, 598];
 bank_eps_bbox_y = [274, 1452];
 
-bank_y_sz = 102.25 + 0.50;
+bank_y_sz = 102.25 + 0.50 + 3.2;
 bank_x_sz = (26.0 + 0.5);
 bank_recess_y = 5;
 
 strap_th = 3;
+strap_w = 5;
 strap_above = 2.5;
 
 retainer_walls = [18, 30];
@@ -78,7 +83,7 @@ screw_max_y_rhs = -main_r -knob_behind_across/2;
 screw_y = min(screw_max_y_lhs,
              screw_max_y_rhs);
 
-bot_y = screw_y -max( screw_nut_across, knob_behind_across/2 )
+bot_y = screw_y -max( screw_nut_across/2, knob_behind_across/2 )
   -minor_wall_min;
 
 holder_x_sz = bank_x_sz + bank_recess_dx*2;
@@ -86,16 +91,19 @@ bank_bot_y = strap_above + strap_th;
 strap_r = strap_th;
 
 brace_total_len = brace_len + main_th;
-brace_ctrs_y = [ straps_y[0] - (brace_r + strap_r/2),
-                straps_y[1] + (brace_r + strap_r/2) ];
+brace_ctrs_y = [ straps_y[0] - (brace_r + strap_w/2),
+                straps_y[1] + (brace_r + strap_w/2) ];
 
-clamp_width_actual = max(clamp_width, 0);
+clamp_width_actual = max(clamp_min_width, holder_x_sz);
 
+hinge_lobes = floor(clamp_width_actual / hinge_lobe_per);
 hinge_stride = (clamp_width_actual + hinge_gap_z) / hinge_lobes;
 
 hinge_outer_r = hinge_around + hinge_pin/2;
 hinge_y = tube_dia/2 + hinge_outer_r;
 
+top_cnr_r = min(endwall_th, main_th);
+
 echo(bot_y);
 
 module TubePlan(){ circle(r = tube_dia/2); }
@@ -233,7 +241,7 @@ module PowerBankStrapCut(){ ////toplevel
 module PowerBankHolderTest(){ ////toplevel
   difference(){
     linextr(-1,5) PowerBankSidePlan();
-    linextr(0, strap_th) PowerBankStrapCut();
+    linextr(0, strap_w) PowerBankStrapCut();
   }
 }
 
@@ -276,14 +284,27 @@ module PowerBankHolder(){ ////toplevel
 
       EndRetainer(retainer_walls[0]);
       mirror([0,1,0]) EndRetainer(retainer_walls[1]);
+
+      translate([0,0, bank_x_sz/2]){
+       for (y = brace_ctrs_y) {
+         translate([0,y,0]) {
+           linextr_x_yz(0, brace_total_len)
+             BraceTubePlan();
+         }
+       }
+       translate([brace_total_len, 0,0])
+         linextr_y_xz(brace_ctrs_y[0] - brace_r,
+                      brace_ctrs_y[1] + brace_r)
+         BraceTubePlan();
+      }
     }
 
     for (strap_y = straps_y)
       translate([0, strap_y, 0])
        rotate([0,0,-90])
        rotate([0,90,0])
-       linextr(-strap_th/2,
-               +strap_th/2)
+       linextr(-strap_w/2,
+               +strap_w/2)
        PowerBankStrapCut();
 
     translate([ bank_bot_y, -bank_y_sz/2, -bank_x_sz/2 ])
@@ -291,19 +312,16 @@ module PowerBankHolder(){ ////toplevel
        rotate([0,0,90])
        translate(bank_input_ctr)
        square(center=true, bank_input_sz);
-  }
 
-  translate([0,0, bank_x_sz/2]){
-    for (y = brace_ctrs_y) {
-      translate([0,y,0]) {
-       linextr_x_yz(0, brace_total_len)
-         BraceTubePlan();
+    translate([0, -(bank_y_sz/2 + endwall_th), 0] + 0.01 * [-1,-1]) {
+      linextr(-200,200){
+       difference(){
+         square(center=true, top_cnr_r*2);
+         translate(top_cnr_r * [1,1])
+           circle(r= top_cnr_r);
+       }
       }
     }
-    translate([brace_total_len, 0,0])
-      linextr_y_xz(brace_ctrs_y[0] - brace_r,
-                  brace_ctrs_y[1] + brace_r)
-      BraceTubePlan();
   }
 }
 
@@ -320,10 +338,15 @@ module TubeClampLeft() { ////toplevel
   }
 }
 
+module PlacePowerBank(){
+  translate([main_r, -mounted_pos_y_offset, 0])
+    children(0);
+}
+
 module Main(){ ////toplevel
   TubeClampLeft();
   difference(){
-    translate([main_r, -mounted_pos_y_offset, 0])
+    PlacePowerBank()
       PowerBankHolder();
     rotate([0,0,180])
       Screws();
@@ -342,3 +365,11 @@ module TubeClampDemo() { ////toplevel
   rotate([180,0,0])
     TubeClampRight();
 }
+
+module Demo() { ////toplevel
+  Main();
+  rotate([180,0,0])
+    TubeClampRight();
+  PlacePowerBank()
+    %PowerBankItself();
+}