4 include <commitid.scad>
24 interlock_fine = 0.66;
26 interlock_fine_slope = 1.0;
27 interlock_fine_lenslop = 1.0;
33 cutout_l_end_y_front_slop = 0.5;
34 cutout_l_end_y_rear_slop = 0.5;
35 cutout_l_end_x_slop = 0.25;
39 cutout_l_end_curve = 1;
40 cutout_l_end_y_total = cutout_l_end_y
41 + cutout_l_end_y_front_slop + cutout_l_end_y_rear_slop;
45 cutout_tile01_y = 170 - 147 + cutout_l_end_y_front_slop;
46 cutout_tile11_x = cutout_l_end_x + cutout_l_end_curve;
47 cutout_tile11_y = cutout_l_end_y_total - cutout_tile01_y;
54 rearcurve_strt_len = 65;
55 rearcurve_total_len = 84;
57 rearcurve_rad_slop = 0.5;
59 rearcurve_avoid_y = rearcurve_rad + 10;
65 ply_edge_hole_dist = ply_edge_min + ply_hole_dia/2;
67 echo(str("HOLES IN PLY ctr dist from PLY edge = ", ply_edge_hole_dist));
69 hole_slop = (ply_hole_dia - post_dia)/2;
70 tile_hard_edge_hole_dist = ply_edge_hole_dist + hole_slop;
72 echo(str("HOLES IN PLY ctr dist from TILE HARD edge = ",
73 tile_hard_edge_hole_dist));
75 echo(str("HOLES IN PLY ctr dist from TILE ROUND edge = ",
76 tile_hard_edge_hole_dist + round_edge_rad));
78 thehd = [ tile_hard_edge_hole_dist, tile_hard_edge_hole_dist ];
80 thehd_tl = [ -thehd_tr[0], thehd_tr[1] ];
84 interlock_rad = interlock_dia/2;
85 interlock_negative_rad = interlock_rad + 0.125;
87 interlock_sq_adj = 0.2; // arbitrary
92 cylinder(r= post_dia/2, h= tile_th + ply_th - post_shorter);
93 translate([0,0, tile_th]) {
94 cylinder(r= screw_big_dia/2, h= screw_big_len);
95 cylinder(r= screw_dia/2, h= ply_th, $fn=20);
99 tsz = tile_hard_edge_hole_dist - test_edge + 1;
100 translate([0,0, tile_th/2]) {
101 cube([post_dia, tsz*2, tile_th], center=true);
102 cube([tsz*2, post_dia, tile_th], center=true);
108 module Posts(posts) {
110 translate(concat(p, [0]))
115 module TileBase(botleft, topright){
116 size = topright - botleft;
117 botleft_post = botleft + thehd_tr;
118 topright_post = topright + thehd_bl;
121 translate(concat(botleft, [0]))
122 cube(concat(size, [tile_th]));
124 translate( concat(botleft_post, [ -tile_th ])
125 + 0.5 * [ post_dia, post_dia, 0 ] )
126 Commitid_BestCount_M( topright_post-botleft_post
127 + [-post_dia,-post_dia]
131 translate( concat(botleft + [thehd[0], 0], [0]) )
132 Commitid_BestCount([ size[0] - thehd[0]*2, thehd[1] ]);
135 translate(concat(botleft + [test_edge,test_edge], [test_tile_th]))
136 cube(concat(size - [test_edge,test_edge]*2, [tile_th]));
137 translate(concat(botleft_post, [-1]))
138 cube(concat(topright_post-botleft_post, [tile_th+2]));
142 cube(max(test_edge, tile_hard_edge_hole_dist)*2, center=true);
149 m4_dnl INREFFRAME(left_cnr, right_cnr, morevars) { body; }
150 m4_define(`INREFFRAME',`
151 length_vec = ($2) - ($1);
152 length = dist2d([0,0], length_vec);
153 length_uvec = length_vec / length;
154 ortho_uvec = [ -length_uvec[1], length_uvec[0] ];
155 m = [ [ length_uvec[0], ortho_uvec[0], 0, ($1)[0], ],
156 [ length_uvec[1], ortho_uvec[1], 0, ($1)[1], ],
163 m4_dnl INREFFRAME(left_cnr, right_cnr, morevars)
164 m4_dnl INREFFRAME_EDGE { body; }
165 m4_define(`INREFFRAME_EDGE',`
166 translate([0,0, -round_edge_rad])
169 module RoundEdge(left_cnr, right_cnr) {
170 INREFFRAME(left_cnr, right_cnr)
174 cylinder(r= round_edge_rad, h= length, $fn=50);
175 translate([-1, 0, -20])
176 cube([length+2, 20, 20]);
181 module RoundCornerCut(ci) {
182 // ci should be [this_cnr, right_cnr]
183 // where right_cnr is to the right (ie, anticlockwise)
186 offr= round_cnr_rad - round_edge_rad;
187 INREFFRAME(this_cnr, right_cnr) INREFFRAME_EDGE {
189 cube(offr*2 - 0.1, center=true);
190 translate([offr, offr, 0])
191 cylinder(center=true, h=20, r= offr);
196 module RoundCornerAdd(ci) {
199 bigr = round_cnr_rad - round_edge_rad;
200 INREFFRAME(this_cnr, right_cnr) INREFFRAME_EDGE {
202 cube(bigr*2 + 0.1, center=true);
203 translate([bigr, bigr, 0])
204 rotate_extrude(convexity=10, $fn=50)
207 circle(r= round_edge_rad, $fn=50);
215 module InterlockLobePlan(negative) {
216 r = negative ? interlock_negative_rad : interlock_rad;
217 ymir = negative ? 0 : 1;
221 translate([thehd[0], 0]){
225 translate([-dx, -0.1])
226 square([ dx*2, r/2 + 0.1 ]);
228 translate([ xi*dx, r ])
236 module InterlockEdgePlan(negative, nlobes, length, dosquare=true) {
237 for (lobei = [ 0 : nlobes-1 ]) {
238 lobex = (length - thehd[0]*2) * (lobei ? lobei / (nlobes-1) : 0);
239 translate([lobex, 0, 0]) {
240 InterlockLobePlan(negative);
246 slotshorter = negative ? -0.1 : interlock_fine_lenslop;
247 mirror([0, negative])
248 translate([slotshorter, iadj])
249 square([length - slotshorter*2, interlock_fine + iadj*2]);
253 module InterlockEdge(left_cnr, right_cnr, negative=0, nlobes=2) {
254 plusth = negative * 1.0;
255 protr = interlock_fine + interlock_sq_adj;
258 z1 = -tile_th/2 - protr / interlock_fine_slope;
259 z3 = -tile_th/2 + protr / interlock_fine_slope;
261 negsign = negative ? -1 : +1;
262 yprotr = negsign * protr;
264 INREFFRAME(left_cnr, right_cnr) {
265 for (vsect = [ // zs0 zs1 ys0, ys1
266 [ -tile_th-plusth, plusth, 0, 0],
267 [ z1, z2, 0, yprotr],
268 [ z2, z3, yprotr, 0],
278 [ 0,1, -sl, -ys0 + negsign*interlock_sq_adj ],
282 linear_extrude(height=zsd, convexity=10)
283 InterlockEdgePlan(negative, nlobes, length, !!ysd);
288 function TestPiece_holes2corners(holes) =
289 [ holes[0] + thehd_bl,
292 holes[0] + thehd_tl ];
294 module TestPiece1(){ ////toplevel
298 corners = TestPiece_holes2corners(holes);
299 rcs = [corners[0], corners[1]];
302 TileBase(corners[0], corners[2]);
304 RoundEdge(corners[0], corners[1]);
305 RoundEdge(corners[3], corners[0]);
307 InterlockEdge(corners[1], corners[2], 1, nlobes=1);
313 module TestPiece2(){ ////toplevel
317 corners = TestPiece_holes2corners(holes);
318 TileBase(corners[0], corners[2]);
320 RoundEdge(corners[0], corners[1]);
321 InterlockEdge(corners[3], corners[0], 0, nlobes=1);
324 module TestDemo(){ ////toplevel
325 translate([ -thehd[0], 0 ])
328 translate([ +thehd[0] + demo_slop, 0 ])
332 module Machine_Arm(){
333 ysz = cutout_l_end_y_total;
334 // assume the round end is arc of a circle
335 chordlen = dist2d([0,0], [ cutout_l_end_y, cutout_l_end_curve ]);
336 endrad = cutout_l_end_y / cutout_l_end_curve * chordlen;
338 translate([0,0,-30]) linear_extrude(height=60) {
339 translate(tile01_tr + [0, (-cutout_tile01_y + cutout_tile11_y)/2]) {
341 translate([-100, -ysz/2])
343 translate([ endrad - cutout_tile11_x - cutout_l_end_x_slop, 0 ])
344 circle(r=endrad, $fa=0.01,$fd=5);
350 module Machine_Rear(){
351 big_rad = rearcurve_total_len - rearcurve_strt_len + rearcurve_rad;
352 small_rad = rearcurve_rad + rearcurve_rad_slop;
353 translate([ 250 + rearedge_len - cutout_l_end_y + big_rad,
361 cylinder(r = small_rad, h= rearcurve_strt_len);
366 big_rad - rearcurve_rad ]) {
369 rotate_extrude(convexity=10) {
372 circle(r= small_rad);
382 module Machine(){ ////toplevel
391 function Rectangle_corners(c0, sz) =
392 // returns the corners of a rectangle from c0 to c0+sz
393 // if sz is positive, the corners are anticlockwise starting with c0
396 c0 + [ sz[0], sz[1] ],
399 function Rectangle_corners2posts(c) =
405 module Rectangle_TileBase(c) { TileBase(c[0], c[2]); }
407 function Posts_interpolate_one(c0,c1) = [c0, (c0+c1)/2, c1];
410 m4_dnl c is from Rectangle_corners and
411 m4_dnl ix is a corner number
412 m4_dnl expands to two comma-separated corners:
413 m4_dnl that denoted by ix, and the next one anticlockwise
414 m4_define(`R_EDGE',`$1[$2],$1[(($2)+1)%4]')
416 module Tile02(){ ////toplevel
419 c = Rectangle_corners(c0, sz);
420 posts = Rectangle_corners2posts(c);
424 Rectangle_TileBase(c);
426 RoundEdge(R_EDGE(c,0));
427 RoundEdge(R_EDGE(c,3));
428 InterlockEdge(R_EDGE(c,2), 0);
430 InterlockEdge(R_EDGE(c,1), 1);
436 module Tile12(){ ////toplevel
439 c = Rectangle_corners(c0, sz);
440 posts = Rectangle_corners2posts(c);
444 Rectangle_TileBase(c);
446 RoundEdge(R_EDGE(c,2));
447 RoundEdge(R_EDGE(c,3));
449 InterlockEdge(R_EDGE(c,0), 1);
450 InterlockEdge(R_EDGE(c,1), 1);
456 tile_01_11_cnr = [250, 0] + [-cutout_tile11_x, 0];
457 tile_11_10_cnr = [250, 0] + [0, cutout_tile11_y];
459 module Tile11(){ ////toplevel
462 c = Rectangle_corners(c0, sz);
463 cnr_posts = Rectangle_corners2posts(c);
465 Posts_interpolate_one(cnr_posts[0],
466 cnr_posts[1] - [cutout_tile11_x, 0]),
467 [ cnr_posts[1] + [0, cutout_tile11_y],
473 Rectangle_TileBase(c);
475 RoundEdge(R_EDGE(c,2));
476 InterlockEdge(R_EDGE(c,3));
478 InterlockEdge(c[0], tile_01_11_cnr, 1);
479 InterlockEdge(tile_11_10_cnr, c[2], 1);
484 tile_01_00_cnr = [250, 0] + [0, -cutout_tile01_y];
486 module Tile01(){ ////toplevel
489 c = Rectangle_corners(c0, sz);
490 cnr_posts = Rectangle_corners2posts(c);
492 Posts_interpolate_one(R_EDGE(cnr_posts,0)),
493 [ cnr_posts[2] + [0, -cutout_tile01_y] ],
494 Posts_interpolate_one(cnr_posts[2] - [cutout_tile11_x, 0],
499 Rectangle_TileBase(c);
501 RoundEdge(R_EDGE(c,0));
502 InterlockEdge(tile_01_11_cnr, c[3]);
503 InterlockEdge(R_EDGE(c,3));
505 InterlockEdge(c[1], tile_01_00_cnr, 1);
510 module Tile10(){ ////toplevel
513 c = Rectangle_corners(c0, sz);
514 cnr_posts = Rectangle_corners2posts(c);
515 posts = [ cnr_posts[0],
516 cnr_posts[1] + [ -rearedge_len + cutout_l_end_x, 0 ],
517 cnr_posts[1] + [ 0, rearcurve_avoid_y ],
522 Rectangle_TileBase(c);
524 RoundEdge(R_EDGE(c,2));
525 //InterlockEdge(tile_01_11_cnr, c[3]);
526 //InterlockEdge(R_EDGE(c,3));
528 //InterlockEdge(c[1], tile_01_00_cnr, 1);
533 module Demo(){ ////toplevel
534 translate(demo_slop*[-2,1]) color("blue") Tile12();
535 translate(demo_slop*[-2,0]) color("red") Tile02();
536 translate(demo_slop*[-2,1]) color("orange") Tile11();
537 translate(demo_slop*[-2,0]) color("purple") Tile01();
538 translate(demo_slop*[-3,1]) color("blue") Tile10();