chiark / gitweb /
cable-splice-clamp: introduce top and basew, and size top thickness by r1
[reprap-play.git] / cable-splice-clamp.scad
index 35d8be143ade70e29e1ca07c08de9a16c46c3124..55f219a0bf65a293ec5457b627eb1b6b0572f3f4 100644 (file)
 
 include <commitid.scad>
 
-cable_maxdia = 12;
-cable_mindia = 6;
-strap_width = 4 + 0.5;
-total_len = 70;
+rnom = 9;
 
-wallmin = 1.5;
+// alpha is slope angle, which is half of inner concave angle that
+//  wire sits in
+alpha = 40; // degrees
 
-strap_count = 2;
+// mu is minimum number of cable radii that cable tangent point (line)
+//  with splint ought to be away from edge of split
+mu = 1/4;
 
-strap_wall_h = 1.5;
-strap_wall_l = 2.0;
+// wall thickness, and base width as fraction of cable size
+wall_r = 1.5 / 6.5;
+base_r = 0.75;
 
-delta_ellipse = 0.45;
+// for cross-section calculations:
+//
+// origin O is at intersection of straight line segments forming walls
+// C is centre of circle (wire x-section) (of radius r or radius 1)
+//       which is tangent to lines
+// T is said tangent points
+// B is inner base point, which is extension of line from B by mu*r
 
-// calculated
+sina = sin(alpha);
+cosa = cos(alpha);
+tana = sina/cosa;
 
-delta_shift = 1 - delta_ellipse;
+// blah_r is blah where r=1
+// d_AB is distance AB
+// dy_AB is " " " vertical component
 
-roundoff_rad = cable_maxdia/2 * sqrt(delta_shift)
-             + cable_mindia/2 * (1-sqrt(delta_shift));
+d_OT_r = tana;
+d_OB_r = tana + mu;
 
-outerdia = 2*(roundoff_rad / cos(30) + wallmin);
+d_OC_r = 1/cosa;
 
-delta_shift_gap = (cable_maxdia-cable_mindia) * delta_shift;
+dy_OB_r = d_OB_r * sina;
 
-writing_dx = outerdia * sin(30);
-writing_dz = total_len / 3;
+// *0 and *1 relate to smallest and largest wire
+// r[01] is radius
+// r10 is radius ratio
 
-module CrossSection(plus=0) {
-  difference(){
-    for (dx = [-plus, 0, plus])
-      translate([dx, 0])
-      circle(r= outerdia/2, $fn=6);
-
-    intersection(){
-      scale([cable_maxdia,
-            cable_maxdia * delta_shift + cable_mindia * delta_ellipse])
-       circle(r= sqrt(0.5) * delta_shift + 0.5 * delta_ellipse, $fn=4);
-      circle(r= roundoff_rad, $fn=20);
-    }
-
-    square(center=true, [40, delta_shift_gap]);
-  }
-}
+r10 = d_OC_r / dy_OB_r;
 
-module CrossSectionDemo(){ ////toplevel
-  color("blue"){
-    translate([0, delta_shift_gap/2, 0]){
-      difference(){
-        circle(r = cable_maxdia/2, $fn=20);
-       circle(r = cable_mindia/2, $fn=20);
-      }
-    }
-  }
-  
-  linear_extrude(height=20)
-    CrossSection(0);
+r0 = rnom / sqrt(r10);
+r1 = rnom * sqrt(r10);
 
-  color("red")
-    linear_extrude(height=1)
-    CrossSection(2);
-}
+x_B_r =   d_OB_r * cosa;
+y_B_r = -dy_OB_r;
 
-module CompleteClamp(){ ////toplevel
+x_T_r =         sina;
+y_T_r = -tana * sina;
+
+top_r = wall_r - (d_OC_r - 1);
+
+wall_x_r = wall_r / tan(90-alpha);
+
+top = top_r * r1;
+basew = base_r * rnom;
+
+echo(r0,r1, "ratio",r1/r0);
+
+module CrossSection(plus=0) {
   difference(){
-    union(){
-      linear_extrude(height=total_len)
-       CrossSection();
-
-      for (i=[0 : strap_count]){
-       if (i*2 != strap_count) {
-         translate([0, 0,
-                    total_len * (i + 0.5) / (strap_count + 1)])
-           for (m=[0,1]){
-             mirror([0,0,m])
-               translate([0,0, strap_width/2])
-               linear_extrude(height=strap_wall_l)
-               CrossSection(strap_wall_h);
-           }
-       }
-      }
-    }
-
-    for (my = [0,1]) {
-      mirror([0,my,0])
-       translate([-writing_dx/2,
-                  cos(30) * outerdia/2,
-                  (total_len - writing_dz)/2])
-       rotate([90,0,0])
-       Commitid_BestCount([writing_dx, writing_dz]);
-    }
+    polygon([[-0.1,                                y_T_r * r0],
+            [x_T_r * r0,                          y_T_r * r0],
+            [x_B_r * r1,                          y_B_r * r1],
+            [x_B_r * r1 + wall_x_r * rnom + plus, y_B_r * r1],
+            [basew                        + plus, top],
+            [-0.1,                                top]]);
+    translate([0, -d_OC_r * r0])
+      circle(r = r0);
   }
 }
 
-module HalfPrint(){ ////toplevel
-  rotate([0,180,0]){
-    intersection(){
-      rotate([-90,0,-90])
-       CompleteClamp();
-      translate([-100,-100,0]) cube([1000,200,200]);
-    }
+module CrossSectionDemo(){ ////toplevel
+  color("black") CrossSection(2);
+  CrossSection();
+  for (rc=[["red", r1],
+          ["blue",r0]]) {
+    color(rc[0]) translate([0, -d_OC_r * rc[1]]) circle(r = rc[1]);
   }
 }
 
-//CrossSectionDemo();
-//CompleteClamp();
-HalfPrint();
+//CrossSection();
+CrossSectionDemo();