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;
69 ply_edge_hole_dist = ply_edge_min + ply_hole_dia/2;
71 echo(str("HOLES IN PLY ctr dist from PLY edge = ", ply_edge_hole_dist));
73 hole_slop = (ply_hole_dia - post_dia)/2;
74 tile_hard_edge_hole_dist = ply_edge_hole_dist + hole_slop;
76 echo(str("HOLES IN PLY ctr dist from TILE HARD edge = ",
77 tile_hard_edge_hole_dist));
79 echo(str("HOLES IN PLY ctr dist from TILE ROUND edge = ",
80 tile_hard_edge_hole_dist + round_edge_rad));
82 thehd = [ tile_hard_edge_hole_dist, tile_hard_edge_hole_dist ];
84 thehd_tl = [ -thehd_tr[0], thehd_tr[1] ];
88 interlock_rad = interlock_dia/2;
89 interlock_negative_rad = interlock_rad + 0.125;
91 interlock_sq_adj = 0.2; // arbitrary
96 cylinder(r= post_dia/2, h= tile_th + ply_th - post_shorter);
97 translate([0,0, tile_th]) {
98 cylinder(r= screw_big_dia/2, h= screw_big_len);
99 cylinder(r= screw_dia/2, h= ply_th, $fn=20);
103 tsz = tile_hard_edge_hole_dist - test_edge + 1;
104 translate([0,0, tile_th/2]) {
105 cube([post_dia, tsz*2, tile_th], center=true);
106 cube([tsz*2, post_dia, tile_th], center=true);
112 module Posts(posts) {
114 translate(concat(p, [0]))
119 module TileBase(botleft, topright){
120 size = topright - botleft;
121 botleft_post = botleft + thehd_tr;
122 topright_post = topright + thehd_bl;
125 translate(concat(botleft, [0]))
126 cube(concat(size, [tile_th]));
128 translate( concat(botleft_post, [ -tile_th ])
129 + 0.5 * [ post_dia, post_dia, 0 ] )
130 Commitid_BestCount_M( topright_post-botleft_post
131 + [-post_dia,-post_dia]
135 translate( concat(botleft + [thehd[0], 0], [0]) )
136 Commitid_BestCount([ size[0] - thehd[0]*2, thehd[1] ]);
139 translate(concat(botleft + [test_edge,test_edge], [test_tile_th]))
140 cube(concat(size - [test_edge,test_edge]*2, [tile_th]));
141 translate(concat(botleft_post, [-1]))
142 cube(concat(topright_post-botleft_post, [tile_th+2]));
146 cube(max(test_edge, tile_hard_edge_hole_dist)*2, center=true);
153 m4_dnl INREFFRAME(left_cnr, right_cnr, morevars) { body; }
154 m4_define(`INREFFRAME',`
155 length_vec = ($2) - ($1);
156 length = dist2d([0,0], length_vec);
157 length_uvec = length_vec / length;
158 ortho_uvec = [ -length_uvec[1], length_uvec[0] ];
159 m = [ [ length_uvec[0], ortho_uvec[0], 0, ($1)[0], ],
160 [ length_uvec[1], ortho_uvec[1], 0, ($1)[1], ],
167 m4_dnl INREFFRAME(left_cnr, right_cnr, morevars)
168 m4_dnl INREFFRAME_EDGE { body; }
169 m4_define(`INREFFRAME_EDGE',`
170 translate([0,0, -round_edge_rad])
173 module RoundEdge(left_cnr, right_cnr) {
174 INREFFRAME(left_cnr, right_cnr)
178 cylinder(r= round_edge_rad, h= length, $fn=50);
179 translate([-1, 0, -20])
180 cube([length+2, 20, 20]);
185 module RoundCornerCut(ci) {
186 // ci should be [this_cnr, right_cnr]
187 // where right_cnr is to the right (ie, anticlockwise)
190 offr= round_cnr_rad - round_edge_rad;
191 INREFFRAME(this_cnr, right_cnr) INREFFRAME_EDGE {
193 cube(offr*2 - 0.1, center=true);
194 translate([offr, offr, 0])
195 cylinder(center=true, h=20, r= offr);
200 module RoundCornerAdd(ci) {
203 bigr = round_cnr_rad - round_edge_rad;
204 INREFFRAME(this_cnr, right_cnr) INREFFRAME_EDGE {
206 cube(bigr*2 + 0.1, center=true);
207 translate([bigr, bigr, 0])
208 rotate_extrude(convexity=10, $fn=50)
211 circle(r= round_edge_rad, $fn=50);
219 module InterlockLobePlan(negative) {
220 r = negative ? interlock_negative_rad : interlock_rad;
221 ymir = negative ? 0 : 1;
225 translate([thehd[0], 0]){
229 translate([-dx, -0.1])
230 square([ dx*2, r/2 + 0.1 ]);
232 translate([ xi*dx, r ])
240 module InterlockEdgePlan(negative, nlobes, length, dosquare=true) {
241 for (lobei = [ 0 : nlobes-1 ]) {
242 lobex = (length - thehd[0]*2) * (lobei ? lobei / (nlobes-1) : 0);
243 translate([lobex, 0, 0]) {
244 InterlockLobePlan(negative);
250 slotshorter = negative ? -0.1 : interlock_fine_lenslop;
251 mirror([0, negative])
252 translate([slotshorter, iadj])
253 square([length - slotshorter*2, interlock_fine + iadj*2]);
257 module InterlockEdge(left_cnr, right_cnr, negative=0, nlobes=2) {
258 plusth = negative * 1.0;
259 protr = interlock_fine + interlock_sq_adj;
262 z1 = -tile_th/2 - protr / interlock_fine_slope;
263 z3 = -tile_th/2 + protr / interlock_fine_slope;
265 negsign = negative ? -1 : +1;
266 yprotr = negsign * protr;
268 INREFFRAME(left_cnr, right_cnr) {
269 for (vsect = [ // zs0 zs1 ys0, ys1
270 [ -tile_th-plusth, plusth, 0, 0],
271 [ z1, z2, 0, yprotr],
272 [ z2, z3, yprotr, 0],
282 [ 0,1, -sl, -ys0 + negsign*interlock_sq_adj ],
286 linear_extrude(height=zsd, convexity=10)
287 InterlockEdgePlan(negative, nlobes, length, !!ysd);
292 function TestPiece_holes2corners(holes) =
293 [ holes[0] + thehd_bl,
296 holes[0] + thehd_tl ];
298 module TestPiece1(){ ////toplevel
302 corners = TestPiece_holes2corners(holes);
303 rcs = [corners[0], corners[1]];
306 TileBase(corners[0], corners[2]);
308 RoundEdge(corners[0], corners[1]);
309 RoundEdge(corners[3], corners[0]);
311 InterlockEdge(corners[1], corners[2], 1, nlobes=1);
317 module TestPiece2(){ ////toplevel
321 corners = TestPiece_holes2corners(holes);
322 TileBase(corners[0], corners[2]);
324 RoundEdge(corners[0], corners[1]);
325 InterlockEdge(corners[3], corners[0], 0, nlobes=1);
328 module TestDemo(){ ////toplevel
329 translate([ -thehd[0], 0 ])
332 translate([ +thehd[0] + demo_slop, 0 ])
336 module Machine_Arm(){
337 ysz = cutout_l_end_y_total;
338 // assume the round end is arc of a circle
339 chordlen = dist2d([0,0], [ cutout_l_end_y, cutout_l_end_curve ]);
340 endrad = cutout_l_end_y / cutout_l_end_curve * chordlen;
342 translate([0,0,-30]) linear_extrude(height=60) {
343 translate(tile01_tr + [0, (-cutout_tile01_y + cutout_tile11_y)/2]) {
345 translate([-100, -ysz/2])
347 translate([ endrad - cutout_tile11_x - cutout_l_end_x_slop, 0 ])
348 circle(r=endrad, $fa=0.01,$fd=5);
354 module Machine_Rear(){ ////toplevel
355 big_rad = rearcurve_total_len - rearcurve_strt_len + rearcurve_rad;
356 small_rad = rearcurve_rad + rearcurve_rad_slop;
357 translate([ 250 - cutout_l_end_x + rearedge_len,
361 translate([ -reartablet_x,
365 cube([ reartablet_x+1,
368 translate([ rearcurve_strt_len,
376 rotate([0,0, 360/8/2])
377 cylinder(r = small_rad, h= rearcurve_strt_len);
382 big_rad - rearcurve_rad ]) {
385 rotate_extrude(convexity=10) {
389 circle(r= small_rad);
391 circle(r= small_rad);
404 module Machine(){ ////toplevel
409 function Rectangle_corners(c0, sz) =
410 // returns the corners of a rectangle from c0 to c0+sz
411 // if sz is positive, the corners are anticlockwise starting with c0
414 c0 + [ sz[0], sz[1] ],
417 function Rectangle_corners2posts(c) =
423 module Rectangle_TileBase(c) { TileBase(c[0], c[2]); }
425 function Posts_interpolate_one(c0,c1) = [c0, (c0+c1)/2, c1];
428 m4_dnl c is from Rectangle_corners and
429 m4_dnl ix is a corner number
430 m4_dnl expands to two comma-separated corners:
431 m4_dnl that denoted by ix, and the next one anticlockwise
432 m4_define(`R_EDGE',`$1[$2],$1[(($2)+1)%4]')
434 module Tile02(){ ////toplevel
437 c = Rectangle_corners(c0, sz);
438 posts = Rectangle_corners2posts(c);
442 Rectangle_TileBase(c);
444 RoundEdge(R_EDGE(c,0));
445 RoundEdge(R_EDGE(c,3));
446 InterlockEdge(R_EDGE(c,2), 0);
448 InterlockEdge(R_EDGE(c,1), 1);
454 module Tile12(){ ////toplevel
457 c = Rectangle_corners(c0, sz);
458 posts = Rectangle_corners2posts(c);
462 Rectangle_TileBase(c);
464 RoundEdge(R_EDGE(c,2));
465 RoundEdge(R_EDGE(c,3));
467 InterlockEdge(R_EDGE(c,0), 1);
468 InterlockEdge(R_EDGE(c,1), 1);
474 tile_01_11_cnr = [250, 0] + [-cutout_tile11_x, 0];
475 tile_11_10_cnr = [250, 0] + [0, cutout_tile11_y];
477 module Tile11(){ ////toplevel
480 c = Rectangle_corners(c0, sz);
481 cnr_posts = Rectangle_corners2posts(c);
483 Posts_interpolate_one(cnr_posts[0],
484 cnr_posts[1] - [cutout_tile11_x, 0]),
485 [ cnr_posts[1] + [0, cutout_tile11_y],
491 Rectangle_TileBase(c);
493 RoundEdge(R_EDGE(c,2));
494 InterlockEdge(R_EDGE(c,3));
496 InterlockEdge(c[0], tile_01_11_cnr, 1);
497 InterlockEdge(tile_11_10_cnr, c[2], 1);
502 tile_01_00_cnr = [250, 0] + [0, -cutout_tile01_y];
504 module Tile01(){ ////toplevel
507 c = Rectangle_corners(c0, sz);
508 cnr_posts = Rectangle_corners2posts(c);
510 Posts_interpolate_one(R_EDGE(cnr_posts,0)),
511 [ cnr_posts[2] + [0, -cutout_tile01_y] ],
512 Posts_interpolate_one(cnr_posts[2] - [cutout_tile11_x, 0],
517 Rectangle_TileBase(c);
519 RoundEdge(R_EDGE(c,0));
520 InterlockEdge(tile_01_11_cnr, c[3]);
521 InterlockEdge(R_EDGE(c,3));
523 InterlockEdge(c[1], tile_01_00_cnr, 1);
528 module Tile10(){ ////toplevel
531 c = Rectangle_corners(c0, sz);
532 cnr_posts = Rectangle_corners2posts(c);
533 cty = cutout_tile11_y;
534 rcy = cty + rearcurve_avoid_y;
535 posts = [ cnr_posts[0] + [ 0, cty ],
536 cnr_posts[1] + [ -sz[1] + rearedge_len - cutout_l_end_x, cty ],
537 cnr_posts[1] + [ 0, rcy ],
543 Rectangle_TileBase(c);
545 RoundEdge(R_EDGE(c,1));
546 RoundEdge(R_EDGE(c,2));
547 InterlockEdge(c[3], tile_11_10_cnr);
555 module Demo(){ ////toplevel
556 translate(demo_slop*[-2,1]) color("blue") Tile12();
557 translate(demo_slop*[-2,0]) color("red") Tile02();
558 translate(demo_slop*[-2,1]) color("orange") Tile11();
559 translate(demo_slop*[-2,0]) color("purple") Tile01();
560 translate(demo_slop*[-3,1]) color("blue") Tile10();