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 tth = tile_th - test_tile_th + 0.1;
71 translate([0,0, tth/2 + test_tile_th - 0.1]) {
72 cube([post_dia, tsz*2, tth], center=true);
73 cube([tsz*2, post_dia, tth], center=true);
81 translate(concat(p, [0]))
86 module TileBase(botleft, topright){
87 size = topright - botleft;
88 botleft_post = botleft + thehd_tr;
89 topright_post = topright + thehd_bl;
92 translate(concat(botleft, [0]))
93 cube(concat(size, [tile_th]));
95 translate( concat(botleft_post, [ -tile_th ])
96 + 0.5 * [ post_dia, post_dia, 0 ] )
97 Commitid_BestCount_M( topright_post-botleft_post
98 + [-post_dia,-post_dia]
102 translate( concat(botleft + [thehd[0], 0], [0]) )
103 Commitid_BestCount([ size[0] - thehd[0]*2, thehd[1] ]);
105 translate(concat(botleft + [test_edge,test_edge], [test_tile_th]))
106 cube(concat(size - [test_edge,test_edge]*2, [tile_th]));
111 m4_dnl INREFFRAME(left_cnr, right_cnr, morevars) { body; }
112 m4_define(`INREFFRAME',`
113 length_vec = ($2) - ($1);
114 length = dist2d([0,0], length_vec);
115 length_uvec = length_vec / length;
116 ortho_uvec = [ -length_uvec[1], length_uvec[0] ];
117 m = [ [ length_uvec[0], ortho_uvec[0], 0, ($1)[0], ],
118 [ length_uvec[1], ortho_uvec[1], 0, ($1)[1], ],
125 m4_dnl INREFFRAME(left_cnr, right_cnr, morevars)
126 m4_dnl INREFFRAME_EDGE { body; }
127 m4_define(`INREFFRAME_EDGE',`
128 translate([0,0, -round_edge_rad])
131 module RoundEdge(left_cnr, right_cnr) {
132 INREFFRAME(left_cnr, right_cnr)
136 cylinder(r= round_edge_rad, h= length, $fn=50);
137 translate([-1, 0, -20])
138 cube([length+2, 20, 20]);
143 module RoundCornerCut(ci) {
146 offr= round_cnr_rad - round_edge_rad;
147 INREFFRAME(this_cnr, right_cnr) INREFFRAME_EDGE {
149 cube(offr*2 - 0.1, center=true);
150 translate([offr, offr, 0])
151 cylinder(center=true, h=20, r= offr);
156 module RoundCornerAdd(ci) {
159 bigr = round_cnr_rad - round_edge_rad;
160 INREFFRAME(this_cnr, right_cnr) INREFFRAME_EDGE {
162 cube(bigr*2 + 0.1, center=true);
163 translate([bigr, bigr, 0])
164 rotate_extrude(convexity=10, $fn=50)
167 circle(r= round_edge_rad, $fn=50);
175 module InterlockLobePlan(negative) {
176 r = negative ? interlock_negative_rad : interlock_rad;
177 ymir = negative ? 0 : 1;
181 translate([thehd[0], 0]){
185 translate([-dx, -0.1])
186 square([ dx*2, r/2 + 0.1 ]);
188 translate([ xi*dx, r ])
196 module InterlockEdgePlan(negative, nlobes, length, dosquare=true) {
197 for (lobei = [ 0 : nlobes-1 ]) {
198 lobex = (length - thehd[0]*2) * (lobei ? lobei / (nlobes-1) : 0);
199 translate([lobex, 0, 0]) {
200 InterlockLobePlan(negative);
206 slotshorter = negative ? -0.1 : interlock_fine_lenslop;
207 mirror([0, negative])
208 translate([slotshorter, iadj])
209 square([length - slotshorter*2, interlock_fine + iadj*2]);
213 module InterlockEdge(left_cnr, right_cnr, negative=0, nlobes=2) {
214 plusth = negative * 1.0;
215 protr = interlock_fine + interlock_sq_adj;
218 z1 = -tile_th/2 - protr / interlock_fine_slope;
219 z3 = -tile_th/2 + protr / interlock_fine_slope;
221 negsign = negative ? -1 : +1;
222 yprotr = negsign * protr;
224 INREFFRAME(left_cnr, right_cnr) {
225 for (vsect = [ // zs0 zs1 ys0, ys1
226 [ -tile_th-plusth, plusth, 0, 0],
227 [ z1, z2, 0, yprotr],
228 [ z2, z3, yprotr, 0],
238 [ 0,1, -sl, -ys0 + negsign*interlock_sq_adj ],
242 linear_extrude(height=zsd, convexity=10)
243 InterlockEdgePlan(negative, nlobes, length, !!ysd);
248 function TestPiece_holes2corners(holes) =
249 [ holes[0] + thehd_bl,
252 holes[0] + thehd_tl ];
254 module TestPiece1(){ ////toplevel
258 corners = TestPiece_holes2corners(holes);
261 TileBase(corners[0], corners[2]);
263 RoundEdge(corners[0], corners[1]);
264 RoundEdge(corners[3], corners[0]);
266 InterlockEdge(corners[1], corners[2], 1, nlobes=1);
267 RoundCornerCut(corners[0], corners[1]);
269 RoundCornerAdd(corners[0], corners[1]);
272 module TestPiece2(){ ////toplevel
276 corners = TestPiece_holes2corners(holes);
277 TileBase(corners[0], corners[2]);
279 RoundEdge(corners[0], corners[1]);
280 InterlockEdge(corners[3], corners[0], 0, nlobes=1);
283 module TestDemo(){ ////toplevel
284 translate([ -thehd[0], 0 ])
287 translate([ +thehd[0] + demo_slop, 0 ])
291 function Rectangle_corners(c0, sz) =
294 c0 + [ sz[0], sz[1] ],
297 function Rectangle_corners2posts(c) =
303 module Tile02(){ ////toplevel
306 c = Rectangle_corners(c0, sz);
307 posts = Rectangle_corners2posts(c);
311 TileBase(c[0], c[2]);
313 RoundEdge(c[0], c[1]);
314 RoundEdge(c[3], c[0]);
315 InterlockEdge(c[2], c[3], 0);
317 InterlockEdge(c[1], c[2], 1);
323 module Tile12(){ ////toplevel
326 c = Rectangle_corners(c0, sz);
327 posts = Rectangle_corners2posts(c);
331 TileBase(c[0], c[2]);
332 RoundEdge(c[2], c[3]);
333 RoundEdge(c[3], c[0]);
336 InterlockEdge(c[0], c[1], 1);
342 module Demo(){ ////toplevel
343 translate(demo_slop*[-2,1]) color("blue") Tile12();
344 translate(demo_slop*[-2,0]) color("red") Tile02();