chiark / gitweb /
air-hockey-puck: wip
[reprap-play.git] / topeak-mtx-tortec-expeditionrack-adapter.scad
index 731c7be3e085033fb454c11c9d30e3d973da4230..c751f787081e7e3baf778d42e8c49eed23ff140d 100644 (file)
@@ -20,12 +20,12 @@ rear_elevation_nominal = 10.04;
 rear_to_front_distance = 230; // rack cross rail (fam) to very front end
 rear_to_cross_rail = 43.05; // bolt centre to rail centre, rail to rear
 rear_bolt_to_front_bolt = 155.4;
-front_to_cross_rail = 43.05; // XXX // bolt centre to rail centre, rail to front
-front_elevation_nominal = 3;
+front_elevation_nominal = 0; // this parameter adjusts rear too somehow?
 
 cross_rail_distance = 232.09;
 
 general_gap_y = 1.0;
+support_bridge_gap_z = 1.0;
 
 strap_w = 8.0 + 1.0;
 strap_th = 2.5;
@@ -39,6 +39,9 @@ brk_bolt_dia = 5.0 + 0.5;
 brk_nearbolt_recess_dia = 8.86 + 1.5;
 brk_nearbolt_recess_depth = 1.09 + 0.25;
 
+bolt_nut_around = 5;
+bolt_nut_around_y_extra = 3;
+
 brk_bolt_eff_len = 11.78; // inside of recess, to end of bolt
 brk_bolt_len_slop = 0.5;
 brk_bolt_nut_th = 3.89;
@@ -74,6 +77,9 @@ $fs=1;
 
 bolt_z = -brk_block_z/2;
 
+front_to_rear_elevation_change =
+  rear_elevation_nominal - front_elevation_nominal;
+
 main_sz_rhs_z = max(min_on_rail_sz_z, beside_strap_sz*2 + strap_w);
 main_sz_lhs_z = min_on_rail_sz_z;
 
@@ -96,7 +102,15 @@ block_y_min = adapt_main_top_y - main_sz_y;
 
 strap_barrel_x = rack_width_inner/2 + strap_barrel_dia/2;
 
-rack_shear_ratio = -rear_elevation_nominal / rear_to_front_distance;
+rack_shear_ratio = - front_to_rear_elevation_change / rear_to_front_distance;
+
+front_to_cross_rail =
+  cross_rail_distance * sqrt(1 - rack_shear_ratio * rack_shear_ratio)
+  - rear_bolt_to_front_bolt
+  - rear_to_cross_rail
+  - sqrt( pow( cross_rail_distance * rack_shear_ratio, 2 )
+         - pow(  front_to_rear_elevation_change, 2 ) )
+  ;
 
 brk_bolt_nut_top_y = -brk_nearbolt_recess_depth
   - brk_bolt_eff_len + brk_bolt_nut_th + brk_bolt_len_slop;
@@ -223,9 +237,10 @@ module BoltHole(){
     circle(brk_nearbolt_recess_dia/2);
 
   linextr_y_xz( -100, brk_bolt_nut_top_y ) {
-    circle( r= brk_bolt_nut_r, $fn = 6 );
-    translate([ 0, brk_bolt_nut_across_flats/2 ])
-      circle( r=brk_bolt_nut_r/2, $fn = 4);
+    hull()
+      for (dz = [0, support_bridge_gap_z])
+       translate([0, dz])
+         circle( r= brk_bolt_nut_r, $fn = 6 );
   }
 }
 
@@ -243,22 +258,30 @@ module FamLinextr(){
 }
 
 module FamGraspElevation(){
-  hull(){
-    ybot = $rack_rail_y - rack_rail_dia/2 + grasp_large_r
-      - fit_slope_len * 0.5;
-    for (y = [
-             ybot,
-             adapt_main_top_y - grasp_large_r
-             ])
-      for (dx= [/*-1,*/ +1] * rack_rail_dia/2)
-       translate([ -$foreaftmaint_rail_z + dx, y ])
-         circle(r= grasp_large_r);
+  difference(){
+    hull(){
+      ybot = $rack_rail_y - rack_rail_dia/2 + grasp_large_r
+       - fit_slope_len * 0.5;
+      for (y = [
+               ybot,
+               adapt_main_top_y - grasp_large_r
+               ])
+       for (dx= [/*-1,*/ +1] * rack_rail_dia/2)
+         translate([ -$foreaftmaint_rail_z + dx, y ])
+           circle(r= grasp_large_r);
+    }
+    if ($foreaftmaint_cutoff) {
+      translate([ -$foreaftmaint_rail_z, 0 ])
+       rectfromto([-100, -100],
+                  [0, 100]);
+    }
   }
 }
 
 module FamStemElevation(){
   hull(){
-    rectfromto([ -$foreaftmaint_rail_z, adapt_main_top_y ],
+    rectfromto([ -$foreaftmaint_rail_z
+                , adapt_main_top_y ],
               [ 0, block_y_min]);
     translate([
               -$foreaftmaint_rail_z,
@@ -322,8 +345,10 @@ module Principal(){
       }
 
       FamLinextr(){
-       rectfromto([ -foreaftmaint_top_block_zs[0] + bolt_z, 0 ],
-                  [ -foreaftmaint_top_block_zs[1] + bolt_z, block_y_min] );
+       if ($foreaftmaint_top_block) {
+         rectfromto([ -foreaftmaint_top_block_zs[0] + bolt_z, 0 ],
+                    [ -foreaftmaint_top_block_zs[1] + bolt_z, block_y_min] );
+       }
        FamGraspElevation();
       }
       intersection(){
@@ -339,6 +364,13 @@ module Principal(){
                    $foreaftmaint_rail_z ])
          cube(center=true, 100);
       }
+
+      linextr_y_xz( block_y_min - bolt_nut_around_y_extra , adapt_main_top_y )
+       intersection(){
+         translate([ 0, brk_block_z/2 ])
+           circle(r = bolt_nut_around + brk_bolt_nut_r );
+         rectfromto([-100, 0], [+100,+100]);
+      }
     }
 
     RackShear() linextr(-10, main_sz_lhs_z+main_sz_rhs_z) {
@@ -383,26 +415,46 @@ module Principal(){
   }
 }
 
-module RackForDemo(){ ////toplevel
+module ForRackForDemo(){
   elevation = elevation_of_bolt_for(rear_to_cross_rail);
   rack_rail_y = rack_rail_y_of_elevation(elevation);
 
-  rotate([-atan(rack_shear_ratio), 0,0])
-    translate([0, rack_rail_y, brk_block_z/2 + rack_rail_y*rack_shear_ratio]) {
-      for (m=[0]) mirror([m,0,0]) {
-        linextr(-50, 50 + rear_to_cross_rail)
-         translate([rack_rail_x, 0])
-         circle(r= rack_rail_dia/2);
-       }
-      translate([0,0, rear_to_cross_rail])
-       linextr_x_yz(rack_rail_x, -rack_rail_x)
+  rotate([atan(
+              front_to_rear_elevation_change /
+              cross_rail_distance
+              ), 0,0])
+    translate([0, rack_rail_y, brk_block_z/2 + rack_rail_y*rack_shear_ratio])
+    children();
+}
+
+module RackForDemoRails(){
+  ForRackForDemo() {
+    for (m=[0]) mirror([m,0,0]) {
+      linextr(-(50 + cross_rail_distance), 50 + rear_to_cross_rail)
+       translate([rack_rail_x, 0])
        circle(r= rack_rail_dia/2);
     }
+  }
+}
+
+module RackForDemoCrosses(){
+  ForRackForDemo() {
+    for (z = [
+             rear_to_cross_rail,
+             rear_to_cross_rail - cross_rail_distance,
+             ]) {
+      translate([0,0,z])
+       linextr_x_yz(rack_rail_x, -rack_rail_x)
+       circle(r= rack_rail_dia/2, $fn=8);
+    }
+  }
 }
 
 module Front(){ ////toplevel
-  // xxx elevation is wrong
+  rotate([180,0,0])
   Principal($reverse_sign = -1,
+           $foreaftmaint_top_block = false,
+           $foreaftmaint_cutoff = true,
            $elevation_nominal=
       elevation_of_bolt_for(rear_to_cross_rail + rear_bolt_to_front_bolt),
            $foreaftmaint_dz= front_to_cross_rail);
@@ -410,6 +462,8 @@ module Front(){ ////toplevel
 
 module Rear(){ ////toplevel
   Principal($reverse_sign = +1,
+           $foreaftmaint_top_block = true,
+           $foreaftmaint_cutoff = false,
            $elevation_nominal=
       elevation_of_bolt_for(rear_to_cross_rail),
            $foreaftmaint_dz= rear_to_cross_rail);
@@ -432,7 +486,7 @@ module SomeDemo(){
 }
 
 module FrontDemo(){ ////toplevel
-  SomeDemo() Front();
+  SomeDemo() rotate([180,0,0]) Front();
 }
 module RearDemo(){ ////toplevel
   SomeDemo() Rear();
@@ -440,6 +494,9 @@ module RearDemo(){ ////toplevel
 module RearRackDemo(){ ////toplevel
   rotate([atan(rack_shear_ratio),0,0]) SomeDemo() {
     Rear();
-    %RackForDemo();
+    translate([0, 0, -rear_bolt_to_front_bolt])
+      rotate([180,0,0]) Front();
+    %RackForDemoRails();
+    color("blue") RackForDemoCrosses();
   }
 }