4 include <commitid.scad>
25 ply_edge_hole_dist = ply_edge_min + ply_hole_dia/2;
27 echo(str("HOLES IN PLY ctr dist from PLY edge = ", ply_edge_hole_dist));
29 hole_slop = (ply_hole_dia - post_dia)/2;
30 tile_hard_edge_hole_dist = ply_edge_hole_dist + hole_slop;
32 echo(str("HOLES IN PLY ctr dist from TILE HARD edge = ",
33 tile_hard_edge_hole_dist));
35 echo(str("HOLES IN PLY ctr dist from TILE ROUND edge = ",
36 tile_hard_edge_hole_dist + round_edge_rad));
38 thehd = [ tile_hard_edge_hole_dist, tile_hard_edge_hole_dist ];
40 thehd_tl = [ -thehd_tr[0], thehd_tr[1] ];
44 interlock_rad = interlock_dia/2;
45 interlock_negative_rad = interlock_rad + 0.125;
50 cylinder(r= post_dia/2, h= tile_th + ply_th - post_shorter);
51 translate([0,0, tile_th]) {
52 cylinder(r= screw_big_dia/2, h= screw_big_len);
53 cylinder(r= screw_dia/2, h= ply_th, $fn=20);
61 translate(concat(p, [0]))
66 module TileBase(botleft, topright){
67 size = topright - botleft;
68 botleft_post = botleft + thehd_tr;
69 topright_post = topright + thehd_bl;
72 translate(concat(botleft, [0]))
73 cube(concat(size, [tile_th]));
74 translate( concat(botleft_post, [-tile_th])
75 + 0.5 * [ post_dia, post_dia, 0 ] )
76 Commitid_BestCount_M( topright_post-botleft_post
77 + [-post_dia,-post_dia]
82 m4_dnl INREFFRAME(left_cnr, right_cnr, morevars) { body; }
83 m4_define(`INREFFRAME',`
84 length_vec = ($2) - ($1);
85 length = dist2d([0,0], length_vec);
86 length_uvec = length_vec / length;
87 ortho_uvec = [ -length_uvec[1], length_uvec[0] ];
88 m = [ [ length_uvec[0], ortho_uvec[0], 0, ($1)[0], ],
89 [ length_uvec[1], ortho_uvec[1], 0, ($1)[1], ],
96 m4_dnl INREFFRAME(left_cnr, right_cnr, morevars)
97 m4_dnl INREFFRAME_EDGE { body; }
98 m4_define(`INREFFRAME_EDGE',`
99 translate([0,0, -round_edge_rad])
102 module RoundEdge(left_cnr, right_cnr) {
103 INREFFRAME(left_cnr, right_cnr)
107 cylinder(r= round_edge_rad, h= length, $fn=50);
108 translate([-1, 0, -20])
109 cube([length+2, 20, 20]);
114 module RoundLeftCorner(this_cnr, right_cnr) {
115 INREFFRAME(this_cnr, right_cnr) INREFFRAME_EDGE {
117 sphere(r= round_edge_rad, $fn=60);
118 translate([0,0, -20])
124 module InterlockLobePlan(r, ymir) {
127 translate([thehd[0], 0]){
131 translate([-dx, -0.1])
132 square([ dx*2, r/2 + 0.1 ]);
134 translate([ xi*dx, r ])
142 module InterlockLobeCore(negative=0) {
143 r = negative ? interlock_negative_rad : interlock_rad;
144 plusth = negative * 1.0;
145 ymir = negative ? 0 : 1;
146 translate([0, 0, plusth]){
148 linear_extrude(height=tile_th+plusth*2, convexity=10){
149 InterlockLobePlan(r, ymir);
155 module InterlockLobe(this_cnr, right_cnr, negative=0) {
156 INREFFRAME(this_cnr, right_cnr)
157 InterlockLobeCore(negative);
160 module InterlockEdge(left_cnr, right_cnr, negative=0, nlobes=2) {
161 INREFFRAME(left_cnr, right_cnr) {
162 for (lobei = [ 0 : nlobes-1 ]) {
163 lobex = (length - thehd[0]*2) * (lobei ? lobei / (nlobes-1) : 0);
164 translate([lobex, 0, 0])
165 InterlockLobeCore(negative);
170 function TestPiece_holes2corners(holes) =
171 [ holes[0] + thehd_bl,
174 holes[0] + thehd_tl ];
176 module TestPiece1(){ ////toplevel
180 corners = TestPiece_holes2corners(holes);
182 TileBase(corners[0], corners[2]);
183 InterlockLobe(corners[1], corners[2], 1);
186 RoundEdge(corners[0], corners[1]);
187 RoundEdge(corners[3], corners[0]);
188 RoundLeftCorner(corners[0], corners[1]);
191 module TestPiece2(){ ////toplevel
195 corners = TestPiece_holes2corners(holes);
196 TileBase(corners[0], corners[2]);
198 RoundEdge(corners[0], corners[1]);
199 InterlockLobe(corners[3], corners[0]);
202 module TestDemo(){ ////toplevel
203 translate([ -thehd[0], 0 ])
206 translate([ +thehd[0], 0 ])
210 function Rectangle_corners(c0, sz) =
213 c0 + [ sz[0], sz[1] ],
216 function Rectangle_corners2posts(c) =
222 module Tile02(){ ////toplevel
225 c = Rectangle_corners(c0, sz);
226 posts = Rectangle_corners2posts(c);
228 TileBase(c[0], c[2]);
231 RoundEdge(c[0], c[1]);
232 RoundEdge(c[3], c[0]);
233 RoundLeftCorner(c[0], c[1]);
234 InterlockEdge(c[2], c[3], 0, 2);
237 module Tile12(){ ////toplevel
240 c = Rectangle_corners(c0, sz);
241 posts = Rectangle_corners2posts(c);
243 TileBase(c[0], c[2]);
246 RoundEdge(c[2], c[3]);
247 RoundEdge(c[3], c[0]);
248 RoundLeftCorner(c[2], c[3]);
251 module Demo(){ ////toplevel
252 color("blue") Tile12();
253 color("red") Tile02();