chiark / gitweb /
adafruit-powerboost: break out PsuMountWindowsNegative
[reprap-play.git] / powerbank-bike-clamp.scad
index 835f51eaf210a4ead52086df3f38d46c554b43b1..18b3adbd2f3869056f8f6993e490242df6463304 100644 (file)
@@ -15,11 +15,13 @@ minor_wall_min = 1;
 
 screw = 5.0 + 0.75;
 screw_head = 8.7 + 1.2;
+screw_head_space_above = 10;
 screw_nut_across = 7.9 + 0.75;
 screw_nut_th = 3.9 + 0.75;
 
 knob_behind_across = 12.2 + 0.75;
 behind_knob_th = 5;
+knob_standout_h = 2;
 
 clamp_min_width = 20;
 
@@ -49,24 +51,32 @@ strap_th = 3;
 strap_w = 5;
 strap_above = 2.5;
 
+strap_around_over = 1.0;
+strap_around_attach = 2.0;
+
 retainer_walls = [18, 30];
 
 bank_profile_scale_bodge = 1.0;
 
-bank_input_ctr = [ 12.5, 11.5 ]; // from nearest corner
-bank_input_sz  = [ 8.5, 10.5 ];
+bank_output_ctr = [ 12.5, 11.5 ]; // from nearest corner
+bank_output_sz  = [ 11.0, 10.5 ];
 
-mounted_pos_y_offset = 20;
+mounted_pos_y_offset_lim = -100;
 
 liner_th = 0.8;
 
 brace_r = 5;
 brace_len = 50;
 
+straps_y_adj = [ 3.5,
+                0,
+                0 ];
+
 // calculated
 
-straps_y = [ -bank_y_sz * 0.25,
-            +bank_y_sz * 0.25 ];
+straps_y = [ -bank_y_sz * 0.25, // these entries are special and used
+            +bank_y_sz * 0.25, //  for the brace struts
+            0 ];
 
 screw_head_behind = main_th;
 endwall_th = main_th;
@@ -83,7 +93,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;
@@ -91,8 +101,11 @@ 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_w/2),
-                straps_y[1] + (brace_r + strap_w/2) ];
+brace_ctrs_y_nom = [ straps_y[0] - (brace_r + strap_w/2),
+                    straps_y[1] + (brace_r + strap_w/2) ];
+
+brace_ctrs_y = [ (straps_y + straps_y_adj)[0] + (brace_r + strap_w/2),
+                (straps_y + straps_y_adj)[1] + (brace_r + strap_w/2) ];
 
 clamp_width_actual = max(clamp_min_width, holder_x_sz);
 
@@ -102,7 +115,11 @@ 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;
 
-echo(bot_y);
+top_cnr_r = min(endwall_th, main_th);
+
+mounted_pos_y_offset = max(mounted_pos_y_offset_lim,
+                          bot_y - (-(bank_y_sz/2 + endwall_th)));
+
 
 module TubePlan(){ circle(r = tube_dia/2); }
 module HingePinPlan(){ translate([0, hinge_y]) circle(r= hinge_pin/2); }
@@ -162,7 +179,7 @@ module Screws(){
              screw_nut_across / cos(30) + bridge_slop*2],
             center=true);
 
-    linextr_x_yz(-200,
+    linextr_x_yz(-(main_r + bank_recess_y + screw_head_space_above),
                 -(clamp_gap/2 + screw_nut_th + screw_head_behind))
       square([screw_head, screw_head + bridge_slop*2],
             center=true);
@@ -291,13 +308,28 @@ module PowerBankHolder(){ ////toplevel
          }
        }
        translate([brace_total_len, 0,0])
-         linextr_y_xz(brace_ctrs_y[0] - brace_r,
-                      brace_ctrs_y[1] + brace_r)
+         linextr_y_xz(brace_ctrs_y_nom[0] - brace_r,
+                      brace_ctrs_y_nom[1] + brace_r)
          BraceTubePlan();
       }
+
+      for (strap_y = straps_y + straps_y_adj) {
+       translate([0, strap_y, 0]) {
+         linextr(-holder_x_sz/2,
+                 +holder_x_sz/2){
+           hull(){
+             for (dy = [-1,+1] *
+                    (strap_w/2 + strap_around_attach - strap_around_over)) {
+               translate([0, dy, 0])
+                 circle(r=strap_around_over);
+             }
+           }
+         }
+       }
+      }
     }
 
-    for (strap_y = straps_y)
+    for (strap_y = straps_y + straps_y_adj)
       translate([0, strap_y, 0])
        rotate([0,0,-90])
        rotate([0,90,0])
@@ -308,8 +340,18 @@ module PowerBankHolder(){ ////toplevel
     translate([ bank_bot_y, -bank_y_sz/2, -bank_x_sz/2 ])
       linextr_y_xz(-50,50)
        rotate([0,0,90])
-       translate(bank_input_ctr)
-       square(center=true, bank_input_sz);
+       translate(bank_output_ctr)
+       square(center=true, bank_output_sz);
+
+    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);
+       }
+      }
+    }
   }
 }
 
@@ -342,10 +384,29 @@ module Main(){ ////toplevel
 }
 
 module TubeClampRight() { ////toplevel
-  rotate([0,0,180])
-    rotate([180,0,0])
-    SomeClamp()
-    TubeClampRightPlan();
+  rotate([0,0,180]) {
+    rotate([180,0,0]) {
+      difference(){
+       union(){
+         SomeClamp()
+           TubeClampRightPlan();
+
+         translate([clamp_gap/2 + behind_knob_th, screw_y, 0]) {
+           hull(){
+             linextr_x_yz(-0.1, 0)
+               square(center=true,
+                      [knob_behind_across,
+                       knob_behind_across + knob_standout_h*2]);
+             linextr_x_yz(0, knob_standout_h)
+               square(center=true,
+                      knob_behind_across);
+           }
+         }
+       }
+       Screws();
+      }
+    }
+  }
 }
 
 module TubeClampDemo() { ////toplevel