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 RoundCornerCut(this_cnr, right_cnr) {
125 offr= round_cnr_rad - round_edge_rad;
126 INREFFRAME(this_cnr, right_cnr) INREFFRAME_EDGE {
128 cube(offr*2 - 0.1, center=true);
129 translate([offr, offr, 0])
130 cylinder(center=true, h=20, r= offr);
135 module RoundCornerAdd(this_cnr, right_cnr) {
136 bigr = round_cnr_rad - round_edge_rad;
137 INREFFRAME(this_cnr, right_cnr) INREFFRAME_EDGE {
139 cube(bigr*2 + 0.1, center=true);
140 translate([bigr, bigr, 0])
141 rotate_extrude(convexity=10, $fn=50)
144 circle(r= round_edge_rad, $fn=50);
152 module InterlockLobePlan(negative) {
153 r = negative ? interlock_negative_rad : interlock_rad;
154 ymir = negative ? 0 : 1;
158 translate([thehd[0], 0]){
162 translate([-dx, -0.1])
163 square([ dx*2, r/2 + 0.1 ]);
165 translate([ xi*dx, r ])
173 module InterlockEdgePlan(negative, nlobes, length, dosquare=true) {
174 for (lobei = [ 0 : nlobes-1 ]) {
175 lobex = (length - thehd[0]*2) * (lobei ? lobei / (nlobes-1) : 0);
176 translate([lobex, 0, 0]) {
177 InterlockLobePlan(negative);
183 slotshorter = negative ? -0.1 : interlock_fine_lenslop;
184 mirror([0, negative])
185 translate([slotshorter, iadj])
186 square([length - slotshorter*2, interlock_fine + iadj*2]);
190 module InterlockEdge(left_cnr, right_cnr, negative=0, nlobes=2) {
191 plusth = negative * 1.0;
192 protr = interlock_fine + interlock_sq_adj;
195 z1 = -tile_th/2 - protr / interlock_fine_slope;
196 z3 = -tile_th/2 + protr / interlock_fine_slope;
198 negsign = negative ? -1 : +1;
199 yprotr = negsign * protr;
201 INREFFRAME(left_cnr, right_cnr) {
202 for (vsect = [ // zs0 zs1 ys0, ys1
203 [ -tile_th-plusth, plusth, 0, 0],
204 [ z1, z2, 0, yprotr],
205 [ z2, z3, yprotr, 0],
215 [ 0,1, -sl, -ys0 + negsign*interlock_sq_adj ],
219 linear_extrude(height=zsd, convexity=10)
220 InterlockEdgePlan(negative, nlobes, length, !!ysd);
225 function TestPiece_holes2corners(holes) =
226 [ holes[0] + thehd_bl,
229 holes[0] + thehd_tl ];
231 module TestPiece1(){ ////toplevel
235 corners = TestPiece_holes2corners(holes);
238 TileBase(corners[0], corners[2]);
240 RoundEdge(corners[0], corners[1]);
241 RoundEdge(corners[3], corners[0]);
243 InterlockEdge(corners[1], corners[2], 1, nlobes=1);
244 RoundCornerCut(corners[0], corners[1]);
246 RoundCornerAdd(corners[0], corners[1]);
249 module TestPiece2(){ ////toplevel
253 corners = TestPiece_holes2corners(holes);
254 TileBase(corners[0], corners[2]);
256 RoundEdge(corners[0], corners[1]);
257 InterlockEdge(corners[3], corners[0], 0, nlobes=1);
260 module TestDemo(){ ////toplevel
261 translate([ -thehd[0], 0 ])
264 translate([ +thehd[0] + demo_slop, 0 ])
268 function Rectangle_corners(c0, sz) =
271 c0 + [ sz[0], sz[1] ],
274 function Rectangle_corners2posts(c) =
280 module Tile02(){ ////toplevel
283 c = Rectangle_corners(c0, sz);
284 posts = Rectangle_corners2posts(c);
287 TileBase(c[0], c[2]);
289 RoundEdge(c[0], c[1]);
290 RoundEdge(c[3], c[0]);
291 InterlockEdge(c[2], c[3], 0);
293 InterlockEdge(c[1], c[2], 1);
294 RoundCornerCut(c[0], c[1]);
296 RoundCornerAdd(c[0], c[1]);
299 module Tile12(){ ////toplevel
302 c = Rectangle_corners(c0, sz);
303 posts = Rectangle_corners2posts(c);
306 TileBase(c[0], c[2]);
307 RoundEdge(c[2], c[3]);
308 RoundEdge(c[3], c[0]);
311 InterlockEdge(c[0], c[1], 1);
312 RoundCornerCut(c[2], c[3]);
314 RoundCornerAdd(c[2], c[3]);
317 module Demo(){ ////toplevel
318 translate(demo_slop*[-2,1]) color("blue") Tile12();
319 translate(demo_slop*[-2,0]) color("red") Tile02();