4 include <commitid.scad>
24 interlock_fine = 0.66;
26 interlock_fine_slope = 1.0;
27 interlock_fine_lenslop = 1.0;
33 machine_rear_to_front = 85;
35 machine_rear_profile = [
49 machine_front_profile = [
64 cutout_l_end_y_front_slop = 0.5;
65 cutout_l_end_y_rear_slop = 0.5;
66 cutout_l_end_x_slop = 0.25;
69 cutout_l_end_y = machine_rear_to_front;
70 cutout_l_end_curve = 1;
71 cutout_l_end_y_total = cutout_l_end_y
72 + cutout_l_end_y_front_slop + cutout_l_end_y_rear_slop;
74 tile02_tr = [-250, 0];
77 cutout_tile01_y = 170 - 147 + cutout_l_end_y_front_slop;
78 cutout_tile11_x = cutout_l_end_x + cutout_l_end_curve;
79 cutout_tile11_y = cutout_l_end_y_total - cutout_tile01_y;
86 rearcurve_strt_len = 65;
87 rearcurve_total_len = 84;
89 rearcurve_rad_slop = 0.75;
91 rearcurve_avoid_y = rearcurve_rad + 10;
101 ply_edge_hole_dist = ply_edge_min + ply_hole_dia/2;
103 echo(str("HOLES IN PLY ctr dist from PLY edge = ", ply_edge_hole_dist));
105 hole_slop = (ply_hole_dia - post_dia)/2;
106 tile_hard_edge_hole_dist = ply_edge_hole_dist + hole_slop;
108 echo(str("HOLES IN PLY ctr dist from TILE HARD edge = ",
109 tile_hard_edge_hole_dist));
111 echo(str("HOLES IN PLY ctr dist from TILE ROUND edge = ",
112 tile_hard_edge_hole_dist + round_edge_rad));
114 thehd = [ tile_hard_edge_hole_dist, tile_hard_edge_hole_dist ];
116 thehd_tl = [ -thehd_tr[0], thehd_tr[1] ];
117 thehd_bl = -thehd_tr;
118 thehd_br = -thehd_tl;
120 interlock_rad = interlock_dia/2;
121 interlock_negative_rad = interlock_rad + 0.125;
123 interlock_sq_adj = 0.2; // arbitrary
128 cylinder(r= post_dia/2, h= tile_th + ply_th - post_shorter);
129 translate([0,0, tile_th]) {
130 cylinder(r= screw_big_dia/2, h= screw_big_len);
131 cylinder(r= screw_dia/2, h= ply_th, $fn=20);
135 tsz = tile_hard_edge_hole_dist - test_edge + 1;
136 translate([0,0, tile_th/2]) {
137 cube([post_dia, tsz*2, tile_th], center=true);
138 cube([tsz*2, post_dia, tile_th], center=true);
144 module Posts(posts) {
146 translate(concat(p, [0]))
151 module TileBase(botleft, topright){
152 size = topright - botleft;
153 botleft_post = botleft + thehd_tr;
154 topright_post = topright + thehd_bl;
157 translate(concat(botleft, [0]))
158 cube(concat(size, [tile_th]));
160 translate( concat(botleft_post, [ -tile_th ])
161 + 0.5 * [ post_dia, post_dia, 0 ] )
162 Commitid_BestCount_M( topright_post-botleft_post
163 + [-post_dia,-post_dia]
167 translate( concat(botleft + [thehd[0], 0], [0]) )
168 Commitid_BestCount([ size[0] - thehd[0]*2, thehd[1] ]);
171 translate(concat(botleft + [test_edge,test_edge], [test_tile_th]))
172 cube(concat(size - [test_edge,test_edge]*2, [tile_th]));
173 translate(concat(botleft_post, [-1]))
174 cube(concat(topright_post-botleft_post, [tile_th+2]));
178 cube(max(test_edge, tile_hard_edge_hole_dist)*2, center=true);
185 m4_dnl INREFFRAME(left_cnr, right_cnr, morevars) { body; }
186 m4_define(`INREFFRAME',`
187 length_vec = ($2) - ($1);
188 length = dist2d([0,0], length_vec);
189 length_uvec = length_vec / length;
190 ortho_uvec = [ -length_uvec[1], length_uvec[0] ];
191 m = [ [ length_uvec[0], ortho_uvec[0], 0, ($1)[0], ],
192 [ length_uvec[1], ortho_uvec[1], 0, ($1)[1], ],
199 m4_dnl INREFFRAME(left_cnr, right_cnr, morevars)
200 m4_dnl INREFFRAME_EDGE { body; }
201 m4_define(`INREFFRAME_EDGE',`
202 translate([0,0, -round_edge_rad])
205 module RoundEdge(left_cnr, right_cnr) {
206 INREFFRAME(left_cnr, right_cnr)
210 cylinder(r= round_edge_rad, h= length, $fn=50);
211 translate([-1, 0, -20])
212 cube([length+2, 20, 20]);
217 module RoundCornerCut(ci) {
218 // ci should be [this_cnr, right_cnr]
219 // where right_cnr is to the right (ie, anticlockwise)
222 offr= round_cnr_rad - round_edge_rad;
223 INREFFRAME(this_cnr, right_cnr) INREFFRAME_EDGE {
225 cube(offr*2 - 0.1, center=true);
226 translate([offr, offr, 0])
227 cylinder(center=true, h=20, r= offr);
232 module RoundCornerAdd(ci) {
235 bigr = round_cnr_rad - round_edge_rad;
236 INREFFRAME(this_cnr, right_cnr) INREFFRAME_EDGE {
238 cube(bigr*2 + 0.1, center=true);
239 translate([bigr, bigr, 0])
240 rotate_extrude(convexity=10, $fn=50)
243 circle(r= round_edge_rad, $fn=50);
251 module InterlockLobePlan(negative) {
252 r = negative ? interlock_negative_rad : interlock_rad;
253 ymir = negative ? 0 : 1;
257 translate([thehd[0], 0]){
261 translate([-dx, -0.1])
262 square([ dx*2, r/2 + 0.1 ]);
264 translate([ xi*dx, r ])
272 module InterlockEdgePlan(negative, nlobes, length, dosquare=true) {
273 for (lobei = [ 0 : nlobes-1 ]) {
274 lobex = (length - thehd[0]*2) * (lobei ? lobei / (nlobes-1) : 0);
275 translate([lobex, 0, 0]) {
276 InterlockLobePlan(negative);
282 slotshorter = negative ? -0.1 : interlock_fine_lenslop;
283 mirror([0, negative])
284 translate([slotshorter, iadj])
285 square([length - slotshorter*2, interlock_fine + iadj*2]);
289 module InterlockEdge(left_cnr, right_cnr, negative=0, nlobes=2) {
290 plusth = negative * 1.0;
291 protr = interlock_fine + interlock_sq_adj;
294 z1 = -tile_th/2 - protr / interlock_fine_slope;
295 z3 = -tile_th/2 + protr / interlock_fine_slope;
297 negsign = negative ? -1 : +1;
298 yprotr = negsign * protr;
300 INREFFRAME(left_cnr, right_cnr) {
301 for (vsect = [ // zs0 zs1 ys0, ys1
302 [ -tile_th-plusth, plusth, 0, 0],
303 [ z1, z2, 0, yprotr],
304 [ z2, z3, yprotr, 0],
314 [ 0,1, -sl, -ys0 + negsign*interlock_sq_adj ],
318 linear_extrude(height=zsd, convexity=10)
319 InterlockEdgePlan(negative, nlobes, length, !!ysd);
324 function TestPiece_holes2corners(holes) =
325 [ holes[0] + thehd_bl,
328 holes[0] + thehd_tl ];
330 module TestPiece1(){ ////toplevel
334 corners = TestPiece_holes2corners(holes);
335 rcs = [corners[0], corners[1]];
338 TileBase(corners[0], corners[2]);
340 RoundEdge(corners[0], corners[1]);
341 RoundEdge(corners[3], corners[0]);
343 InterlockEdge(corners[1], corners[2], 1, nlobes=1);
349 module TestPiece2(){ ////toplevel
353 corners = TestPiece_holes2corners(holes);
354 TileBase(corners[0], corners[2]);
356 RoundEdge(corners[0], corners[1]);
357 InterlockEdge(corners[3], corners[0], 0, nlobes=1);
360 module TestDemo(){ ////toplevel
361 translate([ -thehd[0], 0 ])
364 translate([ +thehd[0] + demo_slop, 0 ])
368 module Machine_Arm(){
369 ysz = cutout_l_end_y_total;
370 // assume the round end is arc of a circle
371 chordlen = dist2d([0,0], [ cutout_l_end_y, cutout_l_end_curve ]);
372 endrad = cutout_l_end_y / cutout_l_end_curve * chordlen;
374 translate([0,0,-30]) linear_extrude(height=60) {
375 translate(tile01_tr + [0, (-cutout_tile01_y + cutout_tile11_y)/2]) {
377 translate([-100, -ysz/2])
379 translate([ endrad - cutout_tile11_x - cutout_l_end_x_slop, 0 ])
380 circle(r=endrad, $fa=0.01,$fd=5);
386 module Machine_Profile(){
387 first_rear = machine_rear_profile[0];
388 first_front = machine_front_profile[len(machine_front_profile)-1];
389 below_point = 0.5 * ( first_rear + first_front ) + [ 0, -40 ];
390 pol = concat( machine_rear_profile,
392 machine_front_profile);
393 skew_angle = atan2( first_front[1] - first_rear[1],
394 first_front[0] - first_rear[0] );
395 echo(below_point, pol, skew_angle);
396 rotate([0,0, -skew_angle ]){
401 module Machine_Rear(){ ////toplevel
402 big_rad = rearcurve_total_len - rearcurve_strt_len + rearcurve_rad;
403 small_rad = rearcurve_rad + rearcurve_rad_slop;
404 translate([ tile01_tr[0] - cutout_l_end_x + rearedge_len,
408 translate([ -reartablet_x,
412 cube([ reartablet_x+1,
415 translate([ rearcurve_strt_len,
423 rotate([0,0, 360/8/2])
424 cylinder(r = small_rad, h= rearcurve_strt_len);
429 big_rad - rearcurve_rad ]) {
432 rotate_extrude(convexity=10) {
436 circle(r= small_rad);
438 circle(r= small_rad);
451 module Machine(){ ////toplevel
456 function Rectangle_corners(c0, sz) =
457 // returns the corners of a rectangle from c0 to c0+sz
458 // if sz is positive, the corners are anticlockwise starting with c0
461 c0 + [ sz[0], sz[1] ],
464 function Rectangle_corners2posts(c) =
470 module Rectangle_TileBase(c) { TileBase(c[0], c[2]); }
472 function Posts_interpolate_one(c0,c1) = [c0, (c0+c1)/2, c1];
475 m4_dnl c is from Rectangle_corners and
476 m4_dnl ix is a corner number
477 m4_dnl expands to two comma-separated corners:
478 m4_dnl that denoted by ix, and the next one anticlockwise
479 m4_define(`R_EDGE',`$1[$2],$1[(($2)+1)%4]')
481 module Tile02(){ ////toplevel
483 c0 = tile02_tr + -sz;
484 c = Rectangle_corners(c0, sz);
485 posts = Rectangle_corners2posts(c);
489 Rectangle_TileBase(c);
491 RoundEdge(R_EDGE(c,0));
492 RoundEdge(R_EDGE(c,3));
493 InterlockEdge(R_EDGE(c,2), 0);
495 InterlockEdge(R_EDGE(c,1), 1);
501 module Tile12(){ ////toplevel
503 c0 = tile02_tr + [-sz[0], 0];
504 c = Rectangle_corners(c0, sz);
505 posts = Rectangle_corners2posts(c);
509 Rectangle_TileBase(c);
511 RoundEdge(R_EDGE(c,2));
512 RoundEdge(R_EDGE(c,3));
514 InterlockEdge(R_EDGE(c,0), 1);
515 InterlockEdge(R_EDGE(c,1), 1);
521 tile_01_11_cnr = tile01_tr + [-cutout_tile11_x, 0];
522 tile_11_10_cnr = tile01_tr + [0, cutout_tile11_y];
524 module Tile11(){ ////toplevel
526 c0 = tile02_tr + [0,0];
527 c = Rectangle_corners(c0, sz);
528 cnr_posts = Rectangle_corners2posts(c);
530 Posts_interpolate_one(cnr_posts[0],
531 cnr_posts[1] - [cutout_tile11_x, 0]),
532 [ cnr_posts[1] + [0, cutout_tile11_y],
538 Rectangle_TileBase(c);
540 RoundEdge(R_EDGE(c,2));
541 InterlockEdge(R_EDGE(c,3));
543 InterlockEdge(c[0], tile_01_11_cnr, 1);
544 InterlockEdge(tile_11_10_cnr, c[2], 1);
549 tile_01_00_cnr = tile01_tr + [0, -cutout_tile01_y];
551 module Tile01(){ ////toplevel
553 c0 = tile02_tr + [0,-sz[1]];
554 c = Rectangle_corners(c0, sz);
555 cnr_posts = Rectangle_corners2posts(c);
557 Posts_interpolate_one(R_EDGE(cnr_posts,0)),
558 [ cnr_posts[2] + [0, -cutout_tile01_y] ],
559 Posts_interpolate_one(cnr_posts[2] - [cutout_tile11_x, 0],
564 Rectangle_TileBase(c);
566 RoundEdge(R_EDGE(c,0));
567 InterlockEdge(tile_01_11_cnr, c[3]);
568 InterlockEdge(R_EDGE(c,3));
570 InterlockEdge(c[1], tile_01_00_cnr, 1);
575 module Tile10(){ ////toplevel
577 c0 = tile02_tr + [sz[0],0];
578 c = Rectangle_corners(c0, sz);
579 cnr_posts = Rectangle_corners2posts(c);
580 cty = cutout_tile11_y;
581 rcy = cty + rearcurve_avoid_y;
582 posts = [ cnr_posts[0] + [ 0, cty ],
583 cnr_posts[1] + [ -sz[1] + rearedge_len - cutout_l_end_x, cty ],
584 cnr_posts[1] + [ 0, rcy ],
590 Rectangle_TileBase(c);
592 RoundEdge(R_EDGE(c,1));
593 RoundEdge(R_EDGE(c,2));
594 InterlockEdge(c[3], tile_11_10_cnr);
602 module Demo(){ ////toplevel
603 translate(demo_slop*[-2,1]) color("blue") Tile12();
604 translate(demo_slop*[-2,0]) color("red") Tile02();
605 translate(demo_slop*[-2,1]) color("orange") Tile11();
606 translate(demo_slop*[-2,0]) color("purple") Tile01();
607 translate(demo_slop*[-3,1]) color("blue") Tile10();