4 include <commitid.scad>
24 interlock_fine_lenslop = 1.0;
30 ply_edge_hole_dist = ply_edge_min + ply_hole_dia/2;
32 echo(str("HOLES IN PLY ctr dist from PLY edge = ", ply_edge_hole_dist));
34 hole_slop = (ply_hole_dia - post_dia)/2;
35 tile_hard_edge_hole_dist = ply_edge_hole_dist + hole_slop;
37 echo(str("HOLES IN PLY ctr dist from TILE HARD edge = ",
38 tile_hard_edge_hole_dist));
40 echo(str("HOLES IN PLY ctr dist from TILE ROUND edge = ",
41 tile_hard_edge_hole_dist + round_edge_rad));
43 thehd = [ tile_hard_edge_hole_dist, tile_hard_edge_hole_dist ];
45 thehd_tl = [ -thehd_tr[0], thehd_tr[1] ];
49 interlock_rad = interlock_dia/2;
50 interlock_negative_rad = interlock_rad + 0.125;
55 cylinder(r= post_dia/2, h= tile_th + ply_th - post_shorter);
56 translate([0,0, tile_th]) {
57 cylinder(r= screw_big_dia/2, h= screw_big_len);
58 cylinder(r= screw_dia/2, h= ply_th, $fn=20);
66 translate(concat(p, [0]))
71 module TileBase(botleft, topright){
72 size = topright - botleft;
73 botleft_post = botleft + thehd_tr;
74 topright_post = topright + thehd_bl;
77 translate(concat(botleft, [0]))
78 cube(concat(size, [tile_th]));
79 translate( concat(botleft_post, [-tile_th])
80 + 0.5 * [ post_dia, post_dia, 0 ] )
81 Commitid_BestCount_M( topright_post-botleft_post
82 + [-post_dia,-post_dia]
87 m4_dnl INREFFRAME(left_cnr, right_cnr, morevars) { body; }
88 m4_define(`INREFFRAME',`
89 length_vec = ($2) - ($1);
90 length = dist2d([0,0], length_vec);
91 length_uvec = length_vec / length;
92 ortho_uvec = [ -length_uvec[1], length_uvec[0] ];
93 m = [ [ length_uvec[0], ortho_uvec[0], 0, ($1)[0], ],
94 [ length_uvec[1], ortho_uvec[1], 0, ($1)[1], ],
101 m4_dnl INREFFRAME(left_cnr, right_cnr, morevars)
102 m4_dnl INREFFRAME_EDGE { body; }
103 m4_define(`INREFFRAME_EDGE',`
104 translate([0,0, -round_edge_rad])
107 module RoundEdge(left_cnr, right_cnr) {
108 INREFFRAME(left_cnr, right_cnr)
112 cylinder(r= round_edge_rad, h= length, $fn=50);
113 translate([-1, 0, -20])
114 cube([length+2, 20, 20]);
119 module RoundLeftCorner(this_cnr, right_cnr) {
120 INREFFRAME(this_cnr, right_cnr) INREFFRAME_EDGE {
122 sphere(r= round_edge_rad, $fn=60);
123 translate([0,0, -20])
129 module InterlockLobePlan(negative) {
130 r = negative ? interlock_negative_rad : interlock_rad;
131 ymir = negative ? 0 : 1;
135 translate([thehd[0], 0]){
139 translate([-dx, -0.1])
140 square([ dx*2, r/2 + 0.1 ]);
142 translate([ xi*dx, r ])
150 module InterlockEdgePlan(negative, nlobes, length) {
153 for (lobei = [ 0 : nlobes-1 ]) {
154 lobex = (length - thehd[0]*2) * (lobei ? lobei / (nlobes-1) : 0);
155 translate([lobex, 0, 0]) {
156 InterlockLobePlan(negative);
160 slotshorter = negative ? 0 : interlock_fine_lenslop;
161 mirror([0, negative, 1])
162 translate([slotshorter, iadj])
163 square([length - slotshorter*2, interlock_fine + iadj*2]);
166 module InterlockEdge(left_cnr, right_cnr, negative=0, nlobes=2) {
167 plusth = negative * 1.0;
169 INREFFRAME(left_cnr, right_cnr) {
170 translate([0, 0, plusth]){
172 linear_extrude(height=tile_th+plusth*2, convexity=10){
173 InterlockEdgePlan(negative, nlobes, length);
180 function TestPiece_holes2corners(holes) =
181 [ holes[0] + thehd_bl,
184 holes[0] + thehd_tl ];
186 module TestPiece1(){ ////toplevel
190 corners = TestPiece_holes2corners(holes);
192 TileBase(corners[0], corners[2]);
193 InterlockEdge(corners[1], corners[2], 1, nlobes=1);
196 RoundEdge(corners[0], corners[1]);
197 RoundEdge(corners[3], corners[0]);
198 RoundLeftCorner(corners[0], corners[1]);
201 module TestPiece2(){ ////toplevel
205 corners = TestPiece_holes2corners(holes);
206 TileBase(corners[0], corners[2]);
208 RoundEdge(corners[0], corners[1]);
209 InterlockEdge(corners[3], corners[0], 0, nlobes=1);
212 module TestDemo(){ ////toplevel
213 translate([ -thehd[0], 0 ])
216 translate([ +thehd[0] + demo_slop, 0 ])
220 function Rectangle_corners(c0, sz) =
223 c0 + [ sz[0], sz[1] ],
226 function Rectangle_corners2posts(c) =
232 module Tile02(){ ////toplevel
235 c = Rectangle_corners(c0, sz);
236 posts = Rectangle_corners2posts(c);
238 TileBase(c[0], c[2]);
241 RoundEdge(c[0], c[1]);
242 RoundEdge(c[3], c[0]);
243 RoundLeftCorner(c[0], c[1]);
244 InterlockEdge(c[2], c[3], 0);
247 module Tile12(){ ////toplevel
250 c = Rectangle_corners(c0, sz);
251 posts = Rectangle_corners2posts(c);
253 TileBase(c[0], c[2]);
254 InterlockEdge(c[0], c[1], 1);
257 RoundEdge(c[2], c[3]);
258 RoundEdge(c[3], c[0]);
259 RoundLeftCorner(c[2], c[3]);
262 module Demo(){ ////toplevel
263 translate(demo_slop*[-2,1]) color("blue") Tile12();
264 translate(demo_slop*[-2,0]) color("red") Tile02();