--- /dev/null
+// -*- C -*-
+
+ply_th = 18;
+ply_hole_dia = 15;
+ply_edge_min = 10;
+
+tile_th = 3;
+post_dia = 8;
+
+post_shorter = 1;
+
+screw_dia = 2.2;
+screw_big_dia = 3.6;
+screw_big_len = 4.0;
+
+round_edge_rad = 2.0;
+
+// calculated
+
+ply_edge_hole_dist = ply_edge_min + ply_hole_dia/2;
+
+echo("HOLES IN PLY ctr dist from edge = "+str(ply_edge_hole_dist));
+
+hole_slop = (ply_hole_dia - post_dia)/2;
+tile_hard_edge_hole_dist = ply_edge_hole_dist + hole_slop;
+thehd = [ tile_hard_edge_hole_dist, tile_hard_edge_hole_dist ];
+
+module Post(){
+ mirror([0,0,1]) {
+ difference(){
+ 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);
+ }
+ }
+ }
+}
+
+module Posts(posts) {
+ for (p= posts) {
+ translate([p[0], p[1], 0])
+ Post();
+ }
+}
+
+module TileBase(botleft_post, topright_post){
+ botleft = botleft_post - thehd;
+ size = topright_post - botleft_post + thehd * 2;
+ mirror([0,0,1])
+ translate([botleft[0], botleft[1], 0])
+ cube([size[0], size[1], tile_th]);
+}
+
+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]){
+ difference(){
+ rotate([0,90,0])
+ cylinder(r= round_edge_rad, h= 1.0);
+ translate([-1, 0, -20])
+ cube([3, 20, 20]);
+ }
+ }
+ }
+}
+
+module RoundLeftCorner(this_post, right_post) {
+}
+
+module TestPiece1(){
+ holes = [ [-100, 0],
+ [ 0, 0]
+ ];
+ TileBase(holes[0], holes[1]);
+ Posts(holes);
+ RoundEdge(holes[0], holes[1]);
+ RoundLeftCorner(holes[0], holes[1]);
+}
+
+TestPiece1();