4 include <commitid.scad>
27 ply_edge_hole_dist = ply_edge_min + ply_hole_dia/2;
29 echo(str("HOLES IN PLY ctr dist from PLY edge = ", ply_edge_hole_dist));
31 hole_slop = (ply_hole_dia - post_dia)/2;
32 tile_hard_edge_hole_dist = ply_edge_hole_dist + hole_slop;
34 echo(str("HOLES IN PLY ctr dist from TILE HARD edge = ",
35 tile_hard_edge_hole_dist));
37 echo(str("HOLES IN PLY ctr dist from TILE ROUND edge = ",
38 tile_hard_edge_hole_dist + round_edge_rad));
40 thehd = [ tile_hard_edge_hole_dist, tile_hard_edge_hole_dist ];
42 thehd_tl = [ -thehd_tr[0], thehd_tr[1] ];
46 interlock_rad = interlock_dia/2;
47 interlock_negative_rad = interlock_rad + 0.125;
52 cylinder(r= post_dia/2, h= tile_th + ply_th - post_shorter);
53 translate([0,0, tile_th]) {
54 cylinder(r= screw_big_dia/2, h= screw_big_len);
55 cylinder(r= screw_dia/2, h= ply_th, $fn=20);
63 translate(concat(p, [0]))
68 module TileBase(botleft, topright){
69 size = topright - botleft;
70 botleft_post = botleft + thehd_tr;
71 topright_post = topright + thehd_bl;
74 translate(concat(botleft, [0]))
75 cube(concat(size, [tile_th]));
76 translate( concat(botleft_post, [-tile_th])
77 + 0.5 * [ post_dia, post_dia, 0 ] )
78 Commitid_BestCount_M( topright_post-botleft_post
79 + [-post_dia,-post_dia]
84 m4_dnl INREFFRAME(left_cnr, right_cnr, morevars) { body; }
85 m4_define(`INREFFRAME',`
86 length_vec = ($2) - ($1);
87 length = dist2d([0,0], length_vec);
88 length_uvec = length_vec / length;
89 ortho_uvec = [ -length_uvec[1], length_uvec[0] ];
90 m = [ [ length_uvec[0], ortho_uvec[0], 0, ($1)[0], ],
91 [ length_uvec[1], ortho_uvec[1], 0, ($1)[1], ],
98 m4_dnl INREFFRAME(left_cnr, right_cnr, morevars)
99 m4_dnl INREFFRAME_EDGE { body; }
100 m4_define(`INREFFRAME_EDGE',`
101 translate([0,0, -round_edge_rad])
104 module RoundEdge(left_cnr, right_cnr) {
105 INREFFRAME(left_cnr, right_cnr)
109 cylinder(r= round_edge_rad, h= length, $fn=50);
110 translate([-1, 0, -20])
111 cube([length+2, 20, 20]);
116 module RoundLeftCorner(this_cnr, right_cnr) {
117 INREFFRAME(this_cnr, right_cnr) INREFFRAME_EDGE {
119 sphere(r= round_edge_rad, $fn=60);
120 translate([0,0, -20])
126 module InterlockLobePlan(negative) {
127 r = negative ? interlock_negative_rad : interlock_rad;
128 ymir = negative ? 0 : 1;
132 translate([thehd[0], 0]){
136 translate([-dx, -0.1])
137 square([ dx*2, r/2 + 0.1 ]);
139 translate([ xi*dx, r ])
147 module InterlockEdgePlan(negative, nlobes, length) {
148 for (lobei = [ 0 : nlobes-1 ]) {
149 lobex = (length - thehd[0]*2) * (lobei ? lobei / (nlobes-1) : 0);
150 translate([lobex, 0, 0]) {
151 InterlockLobePlan(negative);
156 module InterlockEdge(left_cnr, right_cnr, negative=0, nlobes=2) {
157 plusth = negative * 1.0;
159 INREFFRAME(left_cnr, right_cnr) {
160 translate([0, 0, plusth]){
162 linear_extrude(height=tile_th+plusth*2, convexity=10){
163 InterlockEdgePlan(negative, nlobes, length);
170 function TestPiece_holes2corners(holes) =
171 [ holes[0] + thehd_bl,
174 holes[0] + thehd_tl ];
176 module TestPiece1(){ ////toplevel
180 corners = TestPiece_holes2corners(holes);
182 TileBase(corners[0], corners[2]);
183 InterlockEdge(corners[1], corners[2], 1, nlobes=1);
186 RoundEdge(corners[0], corners[1]);
187 RoundEdge(corners[3], corners[0]);
188 RoundLeftCorner(corners[0], corners[1]);
191 module TestPiece2(){ ////toplevel
195 corners = TestPiece_holes2corners(holes);
196 TileBase(corners[0], corners[2]);
198 RoundEdge(corners[0], corners[1]);
199 InterlockEdge(corners[3], corners[0], 0, nlobes=1);
202 module TestDemo(){ ////toplevel
203 translate([ -thehd[0], 0 ])
206 translate([ +thehd[0] + demo_slop, 0 ])
210 function Rectangle_corners(c0, sz) =
213 c0 + [ sz[0], sz[1] ],
216 function Rectangle_corners2posts(c) =
222 module Tile02(){ ////toplevel
225 c = Rectangle_corners(c0, sz);
226 posts = Rectangle_corners2posts(c);
228 TileBase(c[0], c[2]);
231 RoundEdge(c[0], c[1]);
232 RoundEdge(c[3], c[0]);
233 RoundLeftCorner(c[0], c[1]);
234 InterlockEdge(c[2], c[3], 0, 2);
237 module Tile12(){ ////toplevel
240 c = Rectangle_corners(c0, sz);
241 posts = Rectangle_corners2posts(c);
243 TileBase(c[0], c[2]);
246 RoundEdge(c[2], c[3]);
247 RoundEdge(c[3], c[0]);
248 RoundLeftCorner(c[2], c[3]);
251 module Demo(){ ////toplevel
252 translate(demo_slop*[-2,1]) color("blue") Tile12();
253 translate(demo_slop*[-2,0]) color("red") Tile02();