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;
68 ply_edge_hole_dist = ply_edge_min + ply_hole_dia/2;
70 echo(str("HOLES IN PLY ctr dist from PLY edge = ", ply_edge_hole_dist));
72 hole_slop = (ply_hole_dia - post_dia)/2;
73 tile_hard_edge_hole_dist = ply_edge_hole_dist + hole_slop;
75 echo(str("HOLES IN PLY ctr dist from TILE HARD edge = ",
76 tile_hard_edge_hole_dist));
78 echo(str("HOLES IN PLY ctr dist from TILE ROUND edge = ",
79 tile_hard_edge_hole_dist + round_edge_rad));
81 thehd = [ tile_hard_edge_hole_dist, tile_hard_edge_hole_dist ];
83 thehd_tl = [ -thehd_tr[0], thehd_tr[1] ];
87 interlock_rad = interlock_dia/2;
88 interlock_negative_rad = interlock_rad + 0.125;
90 interlock_sq_adj = 0.2; // arbitrary
95 cylinder(r= post_dia/2, h= tile_th + ply_th - post_shorter);
96 translate([0,0, tile_th]) {
97 cylinder(r= screw_big_dia/2, h= screw_big_len);
98 cylinder(r= screw_dia/2, h= ply_th, $fn=20);
102 tsz = tile_hard_edge_hole_dist - test_edge + 1;
103 translate([0,0, tile_th/2]) {
104 cube([post_dia, tsz*2, tile_th], center=true);
105 cube([tsz*2, post_dia, tile_th], center=true);
111 module Posts(posts) {
113 translate(concat(p, [0]))
118 module TileBase(botleft, topright){
119 size = topright - botleft;
120 botleft_post = botleft + thehd_tr;
121 topright_post = topright + thehd_bl;
124 translate(concat(botleft, [0]))
125 cube(concat(size, [tile_th]));
127 translate( concat(botleft_post, [ -tile_th ])
128 + 0.5 * [ post_dia, post_dia, 0 ] )
129 Commitid_BestCount_M( topright_post-botleft_post
130 + [-post_dia,-post_dia]
134 translate( concat(botleft + [thehd[0], 0], [0]) )
135 Commitid_BestCount([ size[0] - thehd[0]*2, thehd[1] ]);
138 translate(concat(botleft + [test_edge,test_edge], [test_tile_th]))
139 cube(concat(size - [test_edge,test_edge]*2, [tile_th]));
140 translate(concat(botleft_post, [-1]))
141 cube(concat(topright_post-botleft_post, [tile_th+2]));
145 cube(max(test_edge, tile_hard_edge_hole_dist)*2, center=true);
152 m4_dnl INREFFRAME(left_cnr, right_cnr, morevars) { body; }
153 m4_define(`INREFFRAME',`
154 length_vec = ($2) - ($1);
155 length = dist2d([0,0], length_vec);
156 length_uvec = length_vec / length;
157 ortho_uvec = [ -length_uvec[1], length_uvec[0] ];
158 m = [ [ length_uvec[0], ortho_uvec[0], 0, ($1)[0], ],
159 [ length_uvec[1], ortho_uvec[1], 0, ($1)[1], ],
166 m4_dnl INREFFRAME(left_cnr, right_cnr, morevars)
167 m4_dnl INREFFRAME_EDGE { body; }
168 m4_define(`INREFFRAME_EDGE',`
169 translate([0,0, -round_edge_rad])
172 module RoundEdge(left_cnr, right_cnr) {
173 INREFFRAME(left_cnr, right_cnr)
177 cylinder(r= round_edge_rad, h= length, $fn=50);
178 translate([-1, 0, -20])
179 cube([length+2, 20, 20]);
184 module RoundCornerCut(ci) {
185 // ci should be [this_cnr, right_cnr]
186 // where right_cnr is to the right (ie, anticlockwise)
189 offr= round_cnr_rad - round_edge_rad;
190 INREFFRAME(this_cnr, right_cnr) INREFFRAME_EDGE {
192 cube(offr*2 - 0.1, center=true);
193 translate([offr, offr, 0])
194 cylinder(center=true, h=20, r= offr);
199 module RoundCornerAdd(ci) {
202 bigr = round_cnr_rad - round_edge_rad;
203 INREFFRAME(this_cnr, right_cnr) INREFFRAME_EDGE {
205 cube(bigr*2 + 0.1, center=true);
206 translate([bigr, bigr, 0])
207 rotate_extrude(convexity=10, $fn=50)
210 circle(r= round_edge_rad, $fn=50);
218 module InterlockLobePlan(negative) {
219 r = negative ? interlock_negative_rad : interlock_rad;
220 ymir = negative ? 0 : 1;
224 translate([thehd[0], 0]){
228 translate([-dx, -0.1])
229 square([ dx*2, r/2 + 0.1 ]);
231 translate([ xi*dx, r ])
239 module InterlockEdgePlan(negative, nlobes, length, dosquare=true) {
240 for (lobei = [ 0 : nlobes-1 ]) {
241 lobex = (length - thehd[0]*2) * (lobei ? lobei / (nlobes-1) : 0);
242 translate([lobex, 0, 0]) {
243 InterlockLobePlan(negative);
249 slotshorter = negative ? -0.1 : interlock_fine_lenslop;
250 mirror([0, negative])
251 translate([slotshorter, iadj])
252 square([length - slotshorter*2, interlock_fine + iadj*2]);
256 module InterlockEdge(left_cnr, right_cnr, negative=0, nlobes=2) {
257 plusth = negative * 1.0;
258 protr = interlock_fine + interlock_sq_adj;
261 z1 = -tile_th/2 - protr / interlock_fine_slope;
262 z3 = -tile_th/2 + protr / interlock_fine_slope;
264 negsign = negative ? -1 : +1;
265 yprotr = negsign * protr;
267 INREFFRAME(left_cnr, right_cnr) {
268 for (vsect = [ // zs0 zs1 ys0, ys1
269 [ -tile_th-plusth, plusth, 0, 0],
270 [ z1, z2, 0, yprotr],
271 [ z2, z3, yprotr, 0],
281 [ 0,1, -sl, -ys0 + negsign*interlock_sq_adj ],
285 linear_extrude(height=zsd, convexity=10)
286 InterlockEdgePlan(negative, nlobes, length, !!ysd);
291 function TestPiece_holes2corners(holes) =
292 [ holes[0] + thehd_bl,
295 holes[0] + thehd_tl ];
297 module TestPiece1(){ ////toplevel
301 corners = TestPiece_holes2corners(holes);
302 rcs = [corners[0], corners[1]];
305 TileBase(corners[0], corners[2]);
307 RoundEdge(corners[0], corners[1]);
308 RoundEdge(corners[3], corners[0]);
310 InterlockEdge(corners[1], corners[2], 1, nlobes=1);
316 module TestPiece2(){ ////toplevel
320 corners = TestPiece_holes2corners(holes);
321 TileBase(corners[0], corners[2]);
323 RoundEdge(corners[0], corners[1]);
324 InterlockEdge(corners[3], corners[0], 0, nlobes=1);
327 module TestDemo(){ ////toplevel
328 translate([ -thehd[0], 0 ])
331 translate([ +thehd[0] + demo_slop, 0 ])
335 module Machine_Arm(){
336 ysz = cutout_l_end_y_total;
337 // assume the round end is arc of a circle
338 chordlen = dist2d([0,0], [ cutout_l_end_y, cutout_l_end_curve ]);
339 endrad = cutout_l_end_y / cutout_l_end_curve * chordlen;
341 translate([0,0,-30]) linear_extrude(height=60) {
342 translate(tile01_tr + [0, (-cutout_tile01_y + cutout_tile11_y)/2]) {
344 translate([-100, -ysz/2])
346 translate([ endrad - cutout_tile11_x - cutout_l_end_x_slop, 0 ])
347 circle(r=endrad, $fa=0.01,$fd=5);
353 module Machine_Rear(){ ////toplevel
354 big_rad = rearcurve_total_len - rearcurve_strt_len + rearcurve_rad;
355 small_rad = rearcurve_rad + rearcurve_rad_slop;
356 translate([ 250 + rearedge_len - cutout_l_end_x,
359 translate([ big_rad + rearcurve_rad,
367 rotate([0,0, 360/8/2])
368 cylinder(r = small_rad, h= rearcurve_strt_len);
373 big_rad - rearcurve_rad ]) {
376 rotate_extrude(convexity=10) {
380 circle(r= small_rad);
382 circle(r= small_rad);
395 module Machine(){ ////toplevel
400 function Rectangle_corners(c0, sz) =
401 // returns the corners of a rectangle from c0 to c0+sz
402 // if sz is positive, the corners are anticlockwise starting with c0
405 c0 + [ sz[0], sz[1] ],
408 function Rectangle_corners2posts(c) =
414 module Rectangle_TileBase(c) { TileBase(c[0], c[2]); }
416 function Posts_interpolate_one(c0,c1) = [c0, (c0+c1)/2, c1];
419 m4_dnl c is from Rectangle_corners and
420 m4_dnl ix is a corner number
421 m4_dnl expands to two comma-separated corners:
422 m4_dnl that denoted by ix, and the next one anticlockwise
423 m4_define(`R_EDGE',`$1[$2],$1[(($2)+1)%4]')
425 module Tile02(){ ////toplevel
428 c = Rectangle_corners(c0, sz);
429 posts = Rectangle_corners2posts(c);
433 Rectangle_TileBase(c);
435 RoundEdge(R_EDGE(c,0));
436 RoundEdge(R_EDGE(c,3));
437 InterlockEdge(R_EDGE(c,2), 0);
439 InterlockEdge(R_EDGE(c,1), 1);
445 module Tile12(){ ////toplevel
448 c = Rectangle_corners(c0, sz);
449 posts = Rectangle_corners2posts(c);
453 Rectangle_TileBase(c);
455 RoundEdge(R_EDGE(c,2));
456 RoundEdge(R_EDGE(c,3));
458 InterlockEdge(R_EDGE(c,0), 1);
459 InterlockEdge(R_EDGE(c,1), 1);
465 tile_01_11_cnr = [250, 0] + [-cutout_tile11_x, 0];
466 tile_11_10_cnr = [250, 0] + [0, cutout_tile11_y];
468 module Tile11(){ ////toplevel
471 c = Rectangle_corners(c0, sz);
472 cnr_posts = Rectangle_corners2posts(c);
474 Posts_interpolate_one(cnr_posts[0],
475 cnr_posts[1] - [cutout_tile11_x, 0]),
476 [ cnr_posts[1] + [0, cutout_tile11_y],
482 Rectangle_TileBase(c);
484 RoundEdge(R_EDGE(c,2));
485 InterlockEdge(R_EDGE(c,3));
487 InterlockEdge(c[0], tile_01_11_cnr, 1);
488 InterlockEdge(tile_11_10_cnr, c[2], 1);
493 tile_01_00_cnr = [250, 0] + [0, -cutout_tile01_y];
495 module Tile01(){ ////toplevel
498 c = Rectangle_corners(c0, sz);
499 cnr_posts = Rectangle_corners2posts(c);
501 Posts_interpolate_one(R_EDGE(cnr_posts,0)),
502 [ cnr_posts[2] + [0, -cutout_tile01_y] ],
503 Posts_interpolate_one(cnr_posts[2] - [cutout_tile11_x, 0],
508 Rectangle_TileBase(c);
510 RoundEdge(R_EDGE(c,0));
511 InterlockEdge(tile_01_11_cnr, c[3]);
512 InterlockEdge(R_EDGE(c,3));
514 InterlockEdge(c[1], tile_01_00_cnr, 1);
519 module Tile10(){ ////toplevel
522 c = Rectangle_corners(c0, sz);
523 cnr_posts = Rectangle_corners2posts(c);
524 cty = cutout_tile11_y;
525 rcy = cty + rearcurve_avoid_y;
526 posts = [ cnr_posts[0] + [ 0, cty ],
527 cnr_posts[1] + [ -sz[1] + rearedge_len - cutout_l_end_x, cty ],
528 cnr_posts[1] + [ 0, rcy ],
534 Rectangle_TileBase(c);
536 RoundEdge(R_EDGE(c,1));
537 RoundEdge(R_EDGE(c,2));
538 InterlockEdge(c[3], tile_11_10_cnr);
546 module Demo(){ ////toplevel
547 translate(demo_slop*[-2,1]) color("blue") Tile12();
548 translate(demo_slop*[-2,0]) color("red") Tile02();
549 translate(demo_slop*[-2,1]) color("orange") Tile11();
550 translate(demo_slop*[-2,0]) color("purple") Tile01();
551 translate(demo_slop*[-3,1]) color("blue") Tile10();