chiark / gitweb /
lock-inframe-bracket: MainPlan: add JoinCirc
[reprap-play.git] / lock-inframe-bracket.scad
index d87e7913e55893c824d000b607477061285a9a60..75c9a52e8f05f75f44ba327486bdcc46bb905a27 100644 (file)
@@ -1,5 +1,7 @@
 // -*- C -*-
 
+include <funcs.scad>
+
 tube_dia = 27.5 + 1.625;
 lock_w = 42.5 + 0.5;
 lock_d = 28.0 + 0.5;
@@ -26,6 +28,8 @@ backflange_th = 3.5;
 
 $fn=50;
 
+join_cr = 5;
+
 // calculated
 
 lockshaft_r = [1, 1] * lockshaft_dia / 2;
@@ -36,6 +40,8 @@ back_ohw = back_gap/2 + backflange_th;
 backflange_ymin = tube_or+backflange_d;
 
 lock_0y = tube_dia/2 + lock_d/2 + midweb_d;
+lock_0x = lock_w/2 - lock_d/2;
+lock_0 = [lock_0x,lock_0y];
 
 lock_or = [lock_w, lock_d]/2 + [front_th,front_th];
 
@@ -50,6 +56,21 @@ module oval(sz){ // sz[0] > sz[1]
   }
 }
 
+module JoinCirc(jr){
+  R = tube_or + join_cr;
+  r = lock_or[1] + join_cr;
+  d = dist2d( [0,0], lock_0 );
+  x = (d*d - r*r + R*R) / (2*d);
+  y = sqrt( R*R - x*x );
+
+  echo(lock_0x, lock_0y, R,r, d, x,y);
+
+  rotate(atan2(lock_0y, lock_0x)) {
+    translate([x,-y])
+      circle(r= jr);
+  }
+}
+
 module MainPlan(){
   difference(){
     union(){
@@ -60,6 +81,13 @@ module MainPlan(){
       translate([0, lock_0y]){
        oval(lock_or);
       }
+
+      hull(){
+       for (m=[0,1])
+         mirror([m,0])
+           JoinCirc(0.01);
+       polygon([[0,0], lock_0, [-lock_0[0], lock_0[1]]]);
+      }
     }
 
     circle(r = tube_dia/2);
@@ -69,6 +97,10 @@ module MainPlan(){
     translate([0, lock_0y]){
       oval([lock_w/2, lock_d/2]);
     }
+
+    for (m=[0,1])
+      mirror([m,0])
+       JoinCirc(join_cr);
   }
 }