4 include <commitid.scad>
24 interlock_fine = 0.66;
26 interlock_fine_slope = 1.0;
27 interlock_fine_lenslop = 1.0;
35 ply_edge_hole_dist = ply_edge_min + ply_hole_dia/2;
37 echo(str("HOLES IN PLY ctr dist from PLY edge = ", ply_edge_hole_dist));
39 hole_slop = (ply_hole_dia - post_dia)/2;
40 tile_hard_edge_hole_dist = ply_edge_hole_dist + hole_slop;
42 echo(str("HOLES IN PLY ctr dist from TILE HARD edge = ",
43 tile_hard_edge_hole_dist));
45 echo(str("HOLES IN PLY ctr dist from TILE ROUND edge = ",
46 tile_hard_edge_hole_dist + round_edge_rad));
48 thehd = [ tile_hard_edge_hole_dist, tile_hard_edge_hole_dist ];
50 thehd_tl = [ -thehd_tr[0], thehd_tr[1] ];
54 interlock_rad = interlock_dia/2;
55 interlock_negative_rad = interlock_rad + 0.125;
57 interlock_sq_adj = 0.2; // arbitrary
62 cylinder(r= post_dia/2, h= tile_th + ply_th - post_shorter);
63 translate([0,0, tile_th]) {
64 cylinder(r= screw_big_dia/2, h= screw_big_len);
65 cylinder(r= screw_dia/2, h= ply_th, $fn=20);
69 tsz = tile_hard_edge_hole_dist - test_edge + 1;
70 translate([0,0, tile_th/2]) {
71 cube([post_dia, tsz*2, tile_th], center=true);
72 cube([tsz*2, post_dia, tile_th], center=true);
80 translate(concat(p, [0]))
85 module TileBase(botleft, topright){
86 size = topright - botleft;
87 botleft_post = botleft + thehd_tr;
88 topright_post = topright + thehd_bl;
91 translate(concat(botleft, [0]))
92 cube(concat(size, [tile_th]));
94 translate( concat(botleft_post, [ -tile_th ])
95 + 0.5 * [ post_dia, post_dia, 0 ] )
96 Commitid_BestCount_M( topright_post-botleft_post
97 + [-post_dia,-post_dia]
101 translate( concat(botleft + [thehd[0], 0], [0]) )
102 Commitid_BestCount([ size[0] - thehd[0]*2, thehd[1] ]);
104 translate(concat(botleft + [test_edge,test_edge], [test_tile_th]))
105 cube(concat(size - [test_edge,test_edge]*2, [tile_th]));
106 translate(concat(botleft_post, [-1]))
107 cube(concat(topright_post-botleft_post, [tile_th+2]));
113 m4_dnl INREFFRAME(left_cnr, right_cnr, morevars) { body; }
114 m4_define(`INREFFRAME',`
115 length_vec = ($2) - ($1);
116 length = dist2d([0,0], length_vec);
117 length_uvec = length_vec / length;
118 ortho_uvec = [ -length_uvec[1], length_uvec[0] ];
119 m = [ [ length_uvec[0], ortho_uvec[0], 0, ($1)[0], ],
120 [ length_uvec[1], ortho_uvec[1], 0, ($1)[1], ],
127 m4_dnl INREFFRAME(left_cnr, right_cnr, morevars)
128 m4_dnl INREFFRAME_EDGE { body; }
129 m4_define(`INREFFRAME_EDGE',`
130 translate([0,0, -round_edge_rad])
133 module RoundEdge(left_cnr, right_cnr) {
134 INREFFRAME(left_cnr, right_cnr)
138 cylinder(r= round_edge_rad, h= length, $fn=50);
139 translate([-1, 0, -20])
140 cube([length+2, 20, 20]);
145 module RoundCornerCut(ci) {
148 offr= round_cnr_rad - round_edge_rad;
149 INREFFRAME(this_cnr, right_cnr) INREFFRAME_EDGE {
151 cube(offr*2 - 0.1, center=true);
152 translate([offr, offr, 0])
153 cylinder(center=true, h=20, r= offr);
158 module RoundCornerAdd(ci) {
161 bigr = round_cnr_rad - round_edge_rad;
162 INREFFRAME(this_cnr, right_cnr) INREFFRAME_EDGE {
164 cube(bigr*2 + 0.1, center=true);
165 translate([bigr, bigr, 0])
166 rotate_extrude(convexity=10, $fn=50)
169 circle(r= round_edge_rad, $fn=50);
177 module InterlockLobePlan(negative) {
178 r = negative ? interlock_negative_rad : interlock_rad;
179 ymir = negative ? 0 : 1;
183 translate([thehd[0], 0]){
187 translate([-dx, -0.1])
188 square([ dx*2, r/2 + 0.1 ]);
190 translate([ xi*dx, r ])
198 module InterlockEdgePlan(negative, nlobes, length, dosquare=true) {
199 for (lobei = [ 0 : nlobes-1 ]) {
200 lobex = (length - thehd[0]*2) * (lobei ? lobei / (nlobes-1) : 0);
201 translate([lobex, 0, 0]) {
202 InterlockLobePlan(negative);
208 slotshorter = negative ? -0.1 : interlock_fine_lenslop;
209 mirror([0, negative])
210 translate([slotshorter, iadj])
211 square([length - slotshorter*2, interlock_fine + iadj*2]);
215 module InterlockEdge(left_cnr, right_cnr, negative=0, nlobes=2) {
216 plusth = negative * 1.0;
217 protr = interlock_fine + interlock_sq_adj;
220 z1 = -tile_th/2 - protr / interlock_fine_slope;
221 z3 = -tile_th/2 + protr / interlock_fine_slope;
223 negsign = negative ? -1 : +1;
224 yprotr = negsign * protr;
226 INREFFRAME(left_cnr, right_cnr) {
227 for (vsect = [ // zs0 zs1 ys0, ys1
228 [ -tile_th-plusth, plusth, 0, 0],
229 [ z1, z2, 0, yprotr],
230 [ z2, z3, yprotr, 0],
240 [ 0,1, -sl, -ys0 + negsign*interlock_sq_adj ],
244 linear_extrude(height=zsd, convexity=10)
245 InterlockEdgePlan(negative, nlobes, length, !!ysd);
250 function TestPiece_holes2corners(holes) =
251 [ holes[0] + thehd_bl,
254 holes[0] + thehd_tl ];
256 module TestPiece1(){ ////toplevel
260 corners = TestPiece_holes2corners(holes);
261 rcs = [corners[0], corners[1]];
264 TileBase(corners[0], corners[2]);
266 RoundEdge(corners[0], corners[1]);
267 RoundEdge(corners[3], corners[0]);
269 InterlockEdge(corners[1], corners[2], 1, nlobes=1);
275 module TestPiece2(){ ////toplevel
279 corners = TestPiece_holes2corners(holes);
280 TileBase(corners[0], corners[2]);
282 RoundEdge(corners[0], corners[1]);
283 InterlockEdge(corners[3], corners[0], 0, nlobes=1);
286 module TestDemo(){ ////toplevel
287 translate([ -thehd[0], 0 ])
290 translate([ +thehd[0] + demo_slop, 0 ])
294 function Rectangle_corners(c0, sz) =
297 c0 + [ sz[0], sz[1] ],
300 function Rectangle_corners2posts(c) =
306 module Tile02(){ ////toplevel
309 c = Rectangle_corners(c0, sz);
310 posts = Rectangle_corners2posts(c);
314 TileBase(c[0], c[2]);
316 RoundEdge(c[0], c[1]);
317 RoundEdge(c[3], c[0]);
318 InterlockEdge(c[2], c[3], 0);
320 InterlockEdge(c[1], c[2], 1);
326 module Tile12(){ ////toplevel
329 c = Rectangle_corners(c0, sz);
330 posts = Rectangle_corners2posts(c);
334 TileBase(c[0], c[2]);
335 RoundEdge(c[2], c[3]);
336 RoundEdge(c[3], c[0]);
339 InterlockEdge(c[0], c[1], 1);
345 module Demo(){ ////toplevel
346 translate(demo_slop*[-2,1]) color("blue") Tile12();
347 translate(demo_slop*[-2,0]) color("red") Tile02();