chiark / gitweb /
sewing-table: before RoundEdge cope with identical posts
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 30 Dec 2016 15:57:54 +0000 (15:57 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 30 Dec 2016 15:57:54 +0000 (15:57 +0000)
sewing-table.scad

index 2ddacd1..4913575 100644 (file)
@@ -1,5 +1,7 @@
 // -*- C -*-
 
+include <funcs.scad>
+
 ply_th = 18;
 ply_hole_dia = 15;
 ply_edge_min = 10;
@@ -19,7 +21,7 @@ round_edge_rad = 2.0;
 
 ply_edge_hole_dist = ply_edge_min + ply_hole_dia/2;
 
-echo("HOLES IN PLY ctr dist from edge = "+str(ply_edge_hole_dist));
+echo(str("HOLES IN PLY ctr dist from edge = ", ply_edge_hole_dist));
 
 hole_slop = (ply_hole_dia - post_dia)/2;
 tile_hard_edge_hole_dist = ply_edge_hole_dist + hole_slop;
@@ -31,7 +33,7 @@ module Post(){
       cylinder(r= post_dia/2, h= tile_th + ply_th - post_shorter);
       translate([0,0, tile_th]) {
        cylinder(r= screw_big_dia/2, h= screw_big_len);
-       cylinder(r= screw_dia/2, h= ply_th);
+       cylinder(r= screw_dia/2, h= ply_th, $fn=20);
       }
     }
   }
@@ -54,17 +56,22 @@ module TileBase(botleft_post, topright_post){
 
 module RoundEdge(left_post, right_post) {
   length_vec = right_post - left_post;
-  ortho_vec = [ -length_vec[1], length_vec[0] ] / dist2d(length_vec);
-  multmatrix([ [ length_vec[0],  length_vec[1], 0, left_post[0], ],
-              [ otho_vec[0],    ortho_vec[1],  0, left_post[1], ],
-              [ 0,              0,             1,            0, ],
-              [ 0,              0,             0,            1, ] ]) {
-    translate([0, -tile_hard_edge_hole_dist, -round_edge_rad]){
+  length = dist2d([0,0], length_vec);
+  length_uvec = length_vec / length;
+  ortho_uvec = [ -length_uvec[1], length_uvec[0] ];
+  m = [ [ length_uvec[0],  ortho_uvec[0], 0, left_post[0], ],
+       [ length_uvec[1],  ortho_uvec[1], 0, left_post[1], ],
+       [ 0,              0,              1,            0, ],
+       [ 0,              0,              0,            1, ] ];
+  tlength = length + thehd[1] * 2;
+  echo(m);
+  multmatrix(m) {
+    translate([-thehd[1], -thehd[0], -round_edge_rad]){
       difference(){
        rotate([0,90,0])
-         cylinder(r= round_edge_rad, h= 1.0);
+         cylinder(r= round_edge_rad, h= tlength, $fn=30);
        translate([-1, 0, -20])
-         cube([3, 20, 20]);
+         cube([tlength+2, 20, 20]);
       }
     }
   }
@@ -77,9 +84,10 @@ module TestPiece1(){
   holes = [ [-100, 0],
            [   0, 0]
            ];
-  TileBase(holes[0], holes[1]);
+  %TileBase(holes[0], holes[1]);
   Posts(holes);
   RoundEdge(holes[0], holes[1]);
+  RoundEdge(holes[0] + [ 0, 10 ], holes[0]);
   RoundLeftCorner(holes[0], holes[1]);
 }