4 include <commitid.scad>
24 interlock_fine = 0.66;
26 interlock_fine_slope = 1.0;
27 interlock_fine_lenslop = 1.0;
33 ply_edge_hole_dist = ply_edge_min + ply_hole_dia/2;
35 echo(str("HOLES IN PLY ctr dist from PLY edge = ", ply_edge_hole_dist));
37 hole_slop = (ply_hole_dia - post_dia)/2;
38 tile_hard_edge_hole_dist = ply_edge_hole_dist + hole_slop;
40 echo(str("HOLES IN PLY ctr dist from TILE HARD edge = ",
41 tile_hard_edge_hole_dist));
43 echo(str("HOLES IN PLY ctr dist from TILE ROUND edge = ",
44 tile_hard_edge_hole_dist + round_edge_rad));
46 thehd = [ tile_hard_edge_hole_dist, tile_hard_edge_hole_dist ];
48 thehd_tl = [ -thehd_tr[0], thehd_tr[1] ];
52 interlock_rad = interlock_dia/2;
53 interlock_negative_rad = interlock_rad + 0.125;
55 interlock_sq_adj = 0.2; // arbitrary
60 cylinder(r= post_dia/2, h= tile_th + ply_th - post_shorter);
61 translate([0,0, tile_th]) {
62 cylinder(r= screw_big_dia/2, h= screw_big_len);
63 cylinder(r= screw_dia/2, h= ply_th, $fn=20);
71 translate(concat(p, [0]))
76 module TileBase(botleft, topright){
77 size = topright - botleft;
78 botleft_post = botleft + thehd_tr;
79 topright_post = topright + thehd_bl;
82 translate(concat(botleft, [0]))
83 cube(concat(size, [tile_th]));
84 translate( concat(botleft_post, [-tile_th])
85 + 0.5 * [ post_dia, post_dia, 0 ] )
86 Commitid_BestCount_M( topright_post-botleft_post
87 + [-post_dia,-post_dia]
92 m4_dnl INREFFRAME(left_cnr, right_cnr, morevars) { body; }
93 m4_define(`INREFFRAME',`
94 length_vec = ($2) - ($1);
95 length = dist2d([0,0], length_vec);
96 length_uvec = length_vec / length;
97 ortho_uvec = [ -length_uvec[1], length_uvec[0] ];
98 m = [ [ length_uvec[0], ortho_uvec[0], 0, ($1)[0], ],
99 [ length_uvec[1], ortho_uvec[1], 0, ($1)[1], ],
106 m4_dnl INREFFRAME(left_cnr, right_cnr, morevars)
107 m4_dnl INREFFRAME_EDGE { body; }
108 m4_define(`INREFFRAME_EDGE',`
109 translate([0,0, -round_edge_rad])
112 module RoundEdge(left_cnr, right_cnr) {
113 INREFFRAME(left_cnr, right_cnr)
117 cylinder(r= round_edge_rad, h= length, $fn=50);
118 translate([-1, 0, -20])
119 cube([length+2, 20, 20]);
124 module RoundLeftCorner(this_cnr, right_cnr) {
125 INREFFRAME(this_cnr, right_cnr) INREFFRAME_EDGE {
127 sphere(r= round_edge_rad, $fn=60);
128 translate([0,0, -20])
134 module RoundCornerCut(this_cnr, right_cnr) {
135 offr= round_cnr_rad - round_edge_rad;
136 INREFFRAME(this_cnr, right_cnr) INREFFRAME_EDGE {
138 cube(offr*2 - 0.1, center=true);
139 translate([offr, offr, 0])
140 cylinder(center=true, h=20, r= offr);
145 module RoundCornerAdd(this_cnr, right_cnr) {
146 bigr = round_cnr_rad - round_edge_rad;
147 INREFFRAME(this_cnr, right_cnr) INREFFRAME_EDGE {
149 cube(bigr*2 + 0.1, center=true);
150 translate([bigr, bigr, 0])
151 rotate_extrude(convexity=10, $fn=50)
154 circle(r= round_edge_rad, $fn=50);
162 module InterlockLobePlan(negative) {
163 r = negative ? interlock_negative_rad : interlock_rad;
164 ymir = negative ? 0 : 1;
168 translate([thehd[0], 0]){
172 translate([-dx, -0.1])
173 square([ dx*2, r/2 + 0.1 ]);
175 translate([ xi*dx, r ])
183 module InterlockEdgePlan(negative, nlobes, length, dosquare=true) {
184 for (lobei = [ 0 : nlobes-1 ]) {
185 lobex = (length - thehd[0]*2) * (lobei ? lobei / (nlobes-1) : 0);
186 translate([lobex, 0, 0]) {
187 InterlockLobePlan(negative);
193 slotshorter = negative ? -0.1 : interlock_fine_lenslop;
194 mirror([0, negative])
195 translate([slotshorter, iadj])
196 square([length - slotshorter*2, interlock_fine + iadj*2]);
200 module InterlockEdge(left_cnr, right_cnr, negative=0, nlobes=2) {
201 plusth = negative * 1.0;
202 protr = interlock_fine + interlock_sq_adj;
205 z1 = -tile_th/2 - protr / interlock_fine_slope;
206 z3 = -tile_th/2 + protr / interlock_fine_slope;
208 negsign = negative ? -1 : +1;
209 yprotr = negsign * protr;
211 INREFFRAME(left_cnr, right_cnr) {
212 for (vsect = [ // zs0 zs1 ys0, ys1
213 [ -tile_th-plusth, plusth, 0, 0],
214 [ z1, z2, 0, yprotr],
215 [ z2, z3, yprotr, 0],
225 [ 0,1, -sl, -ys0 + negsign*interlock_sq_adj ],
229 linear_extrude(height=zsd, convexity=10)
230 InterlockEdgePlan(negative, nlobes, length, !!ysd);
235 function TestPiece_holes2corners(holes) =
236 [ holes[0] + thehd_bl,
239 holes[0] + thehd_tl ];
241 module TestPiece1(){ ////toplevel
245 corners = TestPiece_holes2corners(holes);
248 TileBase(corners[0], corners[2]);
250 RoundEdge(corners[0], corners[1]);
251 RoundEdge(corners[3], corners[0]);
253 InterlockEdge(corners[1], corners[2], 1, nlobes=1);
254 RoundCornerCut(corners[0], corners[1]);
256 RoundCornerAdd(corners[0], corners[1]);
259 module TestPiece2(){ ////toplevel
263 corners = TestPiece_holes2corners(holes);
264 TileBase(corners[0], corners[2]);
266 RoundEdge(corners[0], corners[1]);
267 InterlockEdge(corners[3], corners[0], 0, nlobes=1);
270 module TestDemo(){ ////toplevel
271 translate([ -thehd[0], 0 ])
274 translate([ +thehd[0] + demo_slop, 0 ])
278 function Rectangle_corners(c0, sz) =
281 c0 + [ sz[0], sz[1] ],
284 function Rectangle_corners2posts(c) =
290 module Tile02(){ ////toplevel
293 c = Rectangle_corners(c0, sz);
294 posts = Rectangle_corners2posts(c);
297 TileBase(c[0], c[2]);
299 RoundEdge(c[0], c[1]);
300 RoundEdge(c[3], c[0]);
301 InterlockEdge(c[2], c[3], 0);
303 InterlockEdge(c[1], c[2], 1);
304 RoundCornerCut(c[0], c[1]);
306 RoundCornerAdd(c[0], c[1]);
309 module Tile12(){ ////toplevel
312 c = Rectangle_corners(c0, sz);
313 posts = Rectangle_corners2posts(c);
316 TileBase(c[0], c[2]);
317 RoundEdge(c[2], c[3]);
318 RoundEdge(c[3], c[0]);
319 RoundLeftCorner(c[2], c[3]);
322 InterlockEdge(c[0], c[1], 1);
326 module Demo(){ ////toplevel
327 translate(demo_slop*[-2,1]) color("blue") Tile12();
328 translate(demo_slop*[-2,0]) color("red") Tile02();