chiark / gitweb /
air-hockey-puck: wip
[reprap-play.git] / lock-inframe-bracket.scad
index f729fbd55904dfa2f605e569bd8901fba8924973..bfa6e39699b9a8297c509adaf1ffb3143e294c47 100644 (file)
@@ -5,19 +5,20 @@
 
 include <funcs.scad>
 
-tube_dia = 27.5 + 1.625;
+tube_dia = 27.5 + 1.625 + 1.32;
 lock_w = 42.5 + 0.5;
 lock_d = 28.0 + 0.5;
 main_h = 45.0;
 backflange_d = 12;
+backflange_hole_dy = -1;
 lockshaft_dia = 14.35;
 
 cliprecess_h = 16;
-total_h = 45;
+total_h = 75;
 
-back_gap = 14.5;
-main_th = 3.25;
-tube_th = 2.50;
+back_gap = 12.5;
+main_th = 4.50;
+tube_th = 5.50;
 
 midweb_d = 3;
 clip_th = 3.5;
@@ -27,6 +28,8 @@ clip_d = 22.0;
 mountscrew_dia = 4 + 0.5;
 clipbolt_dia = 5 + 0.6;
 
+mountscrew_washer = 10;
+
 backflange_th = 4.5;
 
 $fn=50;
@@ -35,12 +38,16 @@ join_cr = 9;
 
 tube_rear_extra_th = 1;
 
-divide_shaft_w = 3;
-divide_shaft_l = 3;
-divide_head_dx = 3;
-divide_head_th = 3;
+divide_shaft_w = 1.75;
+divide_shaft_l = 1.5;
+divide_head_dx = 1.75;
+divide_head_th = 1.5;
 divide_gap = 0.75;
-divide_heads = 2;
+
+divide_angle = 26;
+divide_fudge_r = 4.75;
+
+backflange_angle = 20;
 
 // calculated
 
@@ -49,7 +56,7 @@ front_th = main_th;
 
 tube_or = tube_dia/2 + tube_th;
 back_ohw = back_gap/2 + backflange_th;
-backflange_ymin = tube_or+backflange_d;
+backflange_ymin = tube_dia/2 + backflange_d;
 
 lock_0y = tube_dia/2 + lock_d/2 + midweb_d;
 lock_0x = lock_w/2 - lock_d/2;
@@ -88,61 +95,114 @@ module JoinCircs(jr){
   }
 }
 
-module DividePlan(){
-  g = divide_gap;
-  dx = divide_head_dx;
-  for (m=[0,1]) mirror([m,0]) {
-    translate([divide_shaft_w, 0]) square([10, g]);
-    for (i=[0:divide_heads-1]) {
-      translate([divide_shaft_w, i*(divide_shaft_l + divide_head_th)]) {
-       translate([0, 0]) square([g, divide_shaft_l + g]);
-       translate([0, divide_shaft_l]) square([divide_head_dx + g, g]);
-       translate([dx, divide_shaft_l]) square([g, divide_head_th + g]);
-       translate([0, divide_shaft_l + divide_head_th])
-         square([divide_head_dx + g, g]);
-      }
+module DivideHook(){ ////toplevel
+  w = tube_th/2;
+  d = divide_gap;
+
+  translate([-1,0] * (w + d + w)){
+    for (sx=[-1,+1])
+      translate([-(w + w+d) * sx, 0]) circle(r= w);
+    difference(){
+      circle(r = 3*w + d);
+      circle(r =   w + d);
+      translate([-10*w, -10*w]) square([20*w, 10*w]);
     }
-    translate([-0.1, (divide_shaft_l + divide_head_th) * divide_heads])
-      square([divide_shaft_w + g, g]);
   }
 }
 
-module MainPlan(){
+module DivideCut(){
+  w = tube_th/2;
+  d = divide_gap;
+  br = tube_dia/2 + tube_th;
+
   difference(){
-    union(){
-      hull(){
-       for (t=[0, tube_rear_extra_th])
-         translate([0, -t])
-           circle(r = tube_or);
-      }
-      translate([-back_ohw,0]) mirror([0,1])
-       square([back_ohw*2, backflange_ymin]);
+    offset(r=divide_gap) DivideHook();
+    DivideHook();
+    translate([-2*w,0]) mirror([0,1]) square([4*w, 4*w]);
+  }
+}
 
-      translate([0, lock_0y]){
-       oval(lock_or);
+module DivideCutB(){
+  w = tube_th/2;
+  d = divide_gap;
+  br = tube_dia/2 + tube_th;
+  
+  intersection(){
+    translate([br - tube_th/2,0]) {
+      difference(){
+       circle(r=br + d);
+       circle(r=br);
       }
+    }
+    translate([-2*w, 0]) mirror([0,1]) square(4*w);
+  }
+}
 
-      hull(){
-       JoinCircs(0.01);
-       polygon([[0,0], lock_0, [-lock_0[0], lock_0[1]]]);
-      }
+module DivideSurround(){
+  w = tube_th/2;
+  d = divide_gap;
+
+  offset(r= w*2) {
+    hull() {
+      DivideCut();
+      translate([-(4*w + 2*d), 8*w]) circle(r=w);
     }
+  }
+}
 
-    circle(r = tube_dia/2);
-    translate([-back_gap/2,1]) mirror([0,1])
-      square([back_gap, backflange_ymin+2]);
+module DivideInPlace(){
+  rotate([0,0, -divide_angle])
+    translate([ -tube_dia/2 -tube_th/2, 0])
+    children();
+}
+
+module MainPlan(){ ////toplevel
+  difference(){
+    union(){
+      difference(){
+       union(){
+         hull(){
+           for (t=[0, tube_rear_extra_th])
+             translate([0, -t])
+               circle(r = tube_or);
+         }
+         rotate([0,0, backflange_angle])
+           translate([-back_ohw,0]) mirror([0,1])
+           square([back_ohw*2, backflange_ymin]);
+
+         translate([0, lock_0y]){
+           oval(lock_or);
+         }
+
+         hull(){
+           JoinCircs(0.01);
+           polygon([[0,0], lock_0, [-lock_0[0], lock_0[1]]]);
+         }
+       }
+
+       rotate([0,0, backflange_angle])
+         translate([-back_gap/2,1]) mirror([0,1])
+         square([back_gap, backflange_ymin+2]);
+
+       JoinCircs(join_cr);
+      }
 
+      DivideInPlace() DivideSurround();
+    }
     translate([0, lock_0y]){
       oval([lock_w/2, lock_d/2]);
     }
 
-    JoinCircs(join_cr);
+    circle(r = tube_dia/2);
+
+    DivideInPlace() DivideCut();
+    DivideInPlace() DivideCutB();
   }
 }
 
 lockshaft_or = lockshaft_r + [clip_th,clip_th];
 cliprecess_ymax = cliprecess_h - lockshaft_r[1];
-clip_ymin = cliprecess_ymax - total_h;
+clip_ymin = cliprecess_ymax - main_h;
 clip_ogap = clip_gap + clip_th*2;
 
 module ClipElevationPositive(){
@@ -181,24 +241,48 @@ module ExtrudeClipElevation(extra=0){
     children(0);
 }
 
-module ThroughHole(r, y, z) {
-  translate([-50, y, z])
+module ThroughHole(r, y, z, x=-50) {
+  translate([x, y, z])
     rotate([0, 90, 0])
     cylinder(r=r, h=100, $fn=20);
 }
 
-module ThroughHoles(){
+module MountingHoleCylinders(r, x=-50){
   for (z=[ 1/4, 3/4 ]) {
-    ThroughHole( mountscrew_dia/2,
-                -tube_or -0.5*backflange_d,
-                total_h * z );
+    rotate([0,0, backflange_angle])
+      ThroughHole( r,
+                  -tube_dia/2 -0.5*backflange_d + backflange_hole_dy,
+                  total_h * z,
+                  x);
   }
+}
+
+module ThroughHoles(){
+  MountingHoleCylinders(mountscrew_dia/2);
 
   ThroughHole( clipbolt_dia/2,
               lock_0y + lock_d/2 + clip_d/2 + front_th/2,
-              total_h - cliprecess_h - clip_th - clip_d/2 );
+              main_h - cliprecess_h - clip_th - clip_d/2 );
 }
 
+module SlopeTrimElevation(){
+  far_corner_nom = [ lock_0y + lock_d/2, main_h ];
+  round_centre = far_corner_nom + lock_d/2 * [0,1];
+  hull(){
+    translate(round_centre) circle(r= lock_d/2);
+    translate([ lock_0y - lock_d/2, total_h ]) square([ lock_d + clip_d, 1 ]);
+    translate(far_corner_nom) square([clip_d*2, 1]);
+  }
+}
+
+module SlopeTrim(){
+  rotate([0,90,0])
+    rotate([0,0,90])
+    translate([0,0, -lock_w])
+    linear_extrude(convexity=100, height=lock_w*2)
+    SlopeTrimElevation();
+}
+    
 module MainPositive(){
   difference(){
     union(){
@@ -209,14 +293,15 @@ module MainPositive(){
   }
 }
 
-module Bracket(){ //// toplevel
+module Bracket(){ ////toplevel
   difference(){
     MainPositive();
     ThroughHoles();
+    SlopeTrim();
   }
 }
 
-module TestTopEdge(){ //// toplevel
+module TestTopEdge(){ ////toplevel
   intersection(){
     translate([0,0, -total_h])
       translate([0,0, 4])
@@ -226,7 +311,7 @@ module TestTopEdge(){ //// toplevel
   }
 }
 
-module TestClipBoltHole(){ //// toplevel
+module TestClipBoltHole(){ ////toplevel
   intersection(){
     union(){
       translate([0, 0, -5])
@@ -239,6 +324,19 @@ module TestClipBoltHole(){ //// toplevel
   }
 }
 
+module Demo(){ ////toplevel
+  Bracket();
+  color("blue") MountingHoleCylinders(mountscrew_dia/2 - 0.1);
+  color("black") MountingHoleCylinders(mountscrew_washer/2,
+                                      back_ohw + 0.25);
+}
+
+module DivideDemo(){ ////toplevel
+  color("black") translate([0,0,-2]) MainPlan();
+  color("grey") DivideInPlace() DivideHook();
+  color("blue") translate([0,0,-4]) DivideInPlace() DivideCut();
+}
+
 //MainPlan();
 //ClipElevationPositive();
 //ClipElevation();
@@ -247,4 +345,5 @@ module TestClipBoltHole(){ //// toplevel
 //TestTopEdge();
 //TestClipBoltHole();
 
-Bracket();
+//Bracket();
+