4 include <commitid.scad>
22 interlock_fine = 0.66;
24 interlock_fine_slope = 1.0;
25 interlock_fine_lenslop = 1.0;
31 ply_edge_hole_dist = ply_edge_min + ply_hole_dia/2;
33 echo(str("HOLES IN PLY ctr dist from PLY edge = ", ply_edge_hole_dist));
35 hole_slop = (ply_hole_dia - post_dia)/2;
36 tile_hard_edge_hole_dist = ply_edge_hole_dist + hole_slop;
38 echo(str("HOLES IN PLY ctr dist from TILE HARD edge = ",
39 tile_hard_edge_hole_dist));
41 echo(str("HOLES IN PLY ctr dist from TILE ROUND edge = ",
42 tile_hard_edge_hole_dist + round_edge_rad));
44 thehd = [ tile_hard_edge_hole_dist, tile_hard_edge_hole_dist ];
46 thehd_tl = [ -thehd_tr[0], thehd_tr[1] ];
50 interlock_rad = interlock_dia/2;
51 interlock_negative_rad = interlock_rad + 0.125;
53 interlock_sq_adj = 0.2; // arbitrary
58 cylinder(r= post_dia/2, h= tile_th + ply_th - post_shorter);
59 translate([0,0, tile_th]) {
60 cylinder(r= screw_big_dia/2, h= screw_big_len);
61 cylinder(r= screw_dia/2, h= ply_th, $fn=20);
69 translate(concat(p, [0]))
74 module TileBase(botleft, topright){
75 size = topright - botleft;
76 botleft_post = botleft + thehd_tr;
77 topright_post = topright + thehd_bl;
80 translate(concat(botleft, [0]))
81 cube(concat(size, [tile_th]));
82 translate( concat(botleft_post, [-tile_th])
83 + 0.5 * [ post_dia, post_dia, 0 ] )
84 Commitid_BestCount_M( topright_post-botleft_post
85 + [-post_dia,-post_dia]
90 m4_dnl INREFFRAME(left_cnr, right_cnr, morevars) { body; }
91 m4_define(`INREFFRAME',`
92 length_vec = ($2) - ($1);
93 length = dist2d([0,0], length_vec);
94 length_uvec = length_vec / length;
95 ortho_uvec = [ -length_uvec[1], length_uvec[0] ];
96 m = [ [ length_uvec[0], ortho_uvec[0], 0, ($1)[0], ],
97 [ length_uvec[1], ortho_uvec[1], 0, ($1)[1], ],
104 m4_dnl INREFFRAME(left_cnr, right_cnr, morevars)
105 m4_dnl INREFFRAME_EDGE { body; }
106 m4_define(`INREFFRAME_EDGE',`
107 translate([0,0, -round_edge_rad])
110 module RoundEdge(left_cnr, right_cnr) {
111 INREFFRAME(left_cnr, right_cnr)
115 cylinder(r= round_edge_rad, h= length, $fn=50);
116 translate([-1, 0, -20])
117 cube([length+2, 20, 20]);
122 module RoundLeftCorner(this_cnr, right_cnr) {
123 INREFFRAME(this_cnr, right_cnr) INREFFRAME_EDGE {
125 sphere(r= round_edge_rad, $fn=60);
126 translate([0,0, -20])
132 module InterlockLobePlan(negative) {
133 r = negative ? interlock_negative_rad : interlock_rad;
134 ymir = negative ? 0 : 1;
138 translate([thehd[0], 0]){
142 translate([-dx, -0.1])
143 square([ dx*2, r/2 + 0.1 ]);
145 translate([ xi*dx, r ])
153 module InterlockEdgePlan(negative, nlobes, length, dosquare=true) {
154 for (lobei = [ 0 : nlobes-1 ]) {
155 lobex = (length - thehd[0]*2) * (lobei ? lobei / (nlobes-1) : 0);
156 translate([lobex, 0, 0]) {
157 InterlockLobePlan(negative);
162 iadj = interlock_sq_adj;
163 slotshorter = negative ? 0 : interlock_fine_lenslop;
164 mirror([0, negative])
165 translate([slotshorter, iadj])
166 square([length - slotshorter*2, interlock_fine + iadj*2]);
170 module InterlockEdge(left_cnr, right_cnr, negative=0, nlobes=2) {
171 plusth = negative * 1.0;
172 protr = interlock_fine + interlock_sq_adj;
175 z1 = -tile_th/2 - protr / interlock_fine_slope;
176 z3 = -tile_th/2 + protr / interlock_fine_slope;
178 yprotr = negative ? -protr : protr;
180 INREFFRAME(left_cnr, right_cnr) {
181 for (vsect = [ // zs0 zs1 ys0, ys1
182 [ -tile_th-plusth, plusth, 0, 0],
183 [ z1, z2, 0, yprotr],
184 [ z2, z3, yprotr, 0],
198 linear_extrude(height=zsd, convexity=10)
199 InterlockEdgePlan(negative, nlobes, length);
204 function TestPiece_holes2corners(holes) =
205 [ holes[0] + thehd_bl,
208 holes[0] + thehd_tl ];
210 module TestPiece1(){ ////toplevel
214 corners = TestPiece_holes2corners(holes);
216 TileBase(corners[0], corners[2]);
217 InterlockEdge(corners[1], corners[2], 1, nlobes=1);
220 RoundEdge(corners[0], corners[1]);
221 RoundEdge(corners[3], corners[0]);
222 RoundLeftCorner(corners[0], corners[1]);
225 module TestPiece2(){ ////toplevel
229 corners = TestPiece_holes2corners(holes);
230 TileBase(corners[0], corners[2]);
232 RoundEdge(corners[0], corners[1]);
233 InterlockEdge(corners[3], corners[0], 0, nlobes=1);
236 module TestDemo(){ ////toplevel
237 translate([ -thehd[0], 0 ])
240 translate([ +thehd[0] + demo_slop, 0 ])
244 function Rectangle_corners(c0, sz) =
247 c0 + [ sz[0], sz[1] ],
250 function Rectangle_corners2posts(c) =
256 module Tile02(){ ////toplevel
259 c = Rectangle_corners(c0, sz);
260 posts = Rectangle_corners2posts(c);
262 TileBase(c[0], c[2]);
263 InterlockEdge(c[1], c[2], 1);
266 RoundEdge(c[0], c[1]);
267 RoundEdge(c[3], c[0]);
268 RoundLeftCorner(c[0], c[1]);
269 InterlockEdge(c[2], c[3], 0);
272 module Tile12(){ ////toplevel
275 c = Rectangle_corners(c0, sz);
276 posts = Rectangle_corners2posts(c);
278 TileBase(c[0], c[2]);
279 InterlockEdge(c[0], c[1], 1);
282 RoundEdge(c[2], c[3]);
283 RoundEdge(c[3], c[0]);
284 RoundLeftCorner(c[2], c[3]);
287 module Demo(){ ////toplevel
288 translate(demo_slop*[-2,1]) color("blue") Tile12();
289 translate(demo_slop*[-2,0]) color("red") Tile02();