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 = [
51 machine_front_profile = [
66 cutout_l_end_y_front_slop = 0.5;
67 cutout_l_end_y_rear_slop = 0.5;
68 cutout_l_end_x_slop = 0.25;
71 cutout_l_end_y = machine_rear_to_front;
72 cutout_l_end_curve = 1;
73 cutout_l_end_y_total = cutout_l_end_y
74 + cutout_l_end_y_front_slop + cutout_l_end_y_rear_slop;
76 tile02_tr = [-250, 0];
79 cutout_tile01_y = 170 - 147 + cutout_l_end_y_front_slop;
80 cutout_tile11_x = cutout_l_end_x + cutout_l_end_curve;
81 cutout_tile11_y = cutout_l_end_y_total - cutout_tile01_y;
87 rearcurve_strt_len = 52;
89 rearcurve_z_slop = 0.75;
91 rearcurve_avoid_y = 35;
93 rearcurve_double_inrad = 26.10 + 8.04;
103 ply_edge_hole_dist = ply_edge_min + ply_hole_dia/2;
105 echo(str("HOLES IN PLY ctr dist from PLY edge = ", ply_edge_hole_dist));
107 hole_slop = (ply_hole_dia - post_dia)/2;
108 tile_hard_edge_hole_dist = ply_edge_hole_dist + hole_slop;
110 echo(str("HOLES IN PLY ctr dist from TILE HARD edge = ",
111 tile_hard_edge_hole_dist));
113 echo(str("HOLES IN PLY ctr dist from TILE ROUND edge = ",
114 tile_hard_edge_hole_dist + round_edge_rad));
116 thehd = [ tile_hard_edge_hole_dist, tile_hard_edge_hole_dist ];
118 thehd_tl = [ -thehd_tr[0], thehd_tr[1] ];
119 thehd_bl = -thehd_tr;
120 thehd_br = -thehd_tl;
122 interlock_rad = interlock_dia/2;
123 interlock_negative_rad = interlock_rad + 0.125;
125 interlock_sq_adj = 0.2; // arbitrary
130 cylinder(r= post_dia/2, h= tile_th + ply_th - post_shorter);
131 translate([0,0, tile_th]) {
132 cylinder(r= screw_big_dia/2, h= screw_big_len);
133 cylinder(r= screw_dia/2, h= ply_th, $fn=20);
137 tsz = tile_hard_edge_hole_dist - test_edge + 1;
138 translate([0,0, tile_th/2]) {
139 cube([post_dia, tsz*2, tile_th], center=true);
140 cube([tsz*2, post_dia, tile_th], center=true);
146 module Posts(posts) {
148 translate(concat(p, [0]))
153 module TileBase(botleft, topright){
154 size = topright - botleft;
155 botleft_post = botleft + thehd_tr;
156 topright_post = topright + thehd_bl;
159 translate(concat(botleft, [0]))
160 cube(concat(size, [tile_th]));
162 translate( concat(botleft_post, [ -tile_th ])
163 + 0.5 * [ post_dia, post_dia, 0 ] )
164 Commitid_BestCount_M( topright_post-botleft_post
165 + [-post_dia,-post_dia]
169 translate( concat(botleft + [thehd[0], 0], [0]) )
170 Commitid_BestCount([ size[0] - thehd[0]*2, thehd[1] ]);
173 translate(concat(botleft + [test_edge,test_edge], [test_tile_th]))
174 cube(concat(size - [test_edge,test_edge]*2, [tile_th]));
175 translate(concat(botleft_post, [-1]))
176 cube(concat(topright_post-botleft_post, [tile_th+2]));
180 cube(max(test_edge, tile_hard_edge_hole_dist)*2, center=true);
187 m4_dnl INREFFRAME(left_cnr, right_cnr, morevars) { body; }
188 m4_define(`INREFFRAME',`
189 length_vec = ($2) - ($1);
190 length = dist2d([0,0], length_vec);
191 length_uvec = length_vec / length;
192 ortho_uvec = [ -length_uvec[1], length_uvec[0] ];
193 m = [ [ length_uvec[0], ortho_uvec[0], 0, ($1)[0], ],
194 [ length_uvec[1], ortho_uvec[1], 0, ($1)[1], ],
201 m4_dnl INREFFRAME(left_cnr, right_cnr, morevars)
202 m4_dnl INREFFRAME_EDGE { body; }
203 m4_define(`INREFFRAME_EDGE',`
204 translate([0,0, -round_edge_rad])
207 module RoundEdge(left_cnr, right_cnr) {
208 INREFFRAME(left_cnr, right_cnr)
212 cylinder(r= round_edge_rad, h= length, $fn=50);
213 translate([-1, 0, -20])
214 cube([length+2, 20, 20]);
219 module RoundCornerCut(ci) {
220 // ci should be [this_cnr, right_cnr]
221 // where right_cnr is to the right (ie, anticlockwise)
224 offr= round_cnr_rad - round_edge_rad;
225 INREFFRAME(this_cnr, right_cnr) INREFFRAME_EDGE {
227 cube(offr*2 - 0.1, center=true);
228 translate([offr, offr, 0])
229 cylinder(center=true, h=20, r= offr);
234 module RoundCornerAdd(ci) {
237 bigr = round_cnr_rad - round_edge_rad;
238 INREFFRAME(this_cnr, right_cnr) INREFFRAME_EDGE {
240 cube(bigr*2 + 0.1, center=true);
241 translate([bigr, bigr, 0])
242 rotate_extrude(convexity=10, $fn=50)
245 circle(r= round_edge_rad, $fn=50);
253 module InterlockLobePlan(negative) {
254 r = negative ? interlock_negative_rad : interlock_rad;
255 ymir = negative ? 0 : 1;
259 translate([thehd[0], 0]){
263 translate([-dx, -0.1])
264 square([ dx*2, r/2 + 0.1 ]);
266 translate([ xi*dx, r ])
274 module InterlockEdgePlan(negative, nlobes, length, dosquare=true) {
275 for (lobei = [ 0 : nlobes-1 ]) {
276 lobex = (length - thehd[0]*2) * (lobei ? lobei / (nlobes-1) : 0);
277 translate([lobex, 0, 0]) {
278 InterlockLobePlan(negative);
284 slotshorter = negative ? -0.1 : interlock_fine_lenslop;
285 mirror([0, negative])
286 translate([slotshorter, iadj])
287 square([length - slotshorter*2, interlock_fine + iadj*2]);
291 module InterlockEdge(left_cnr, right_cnr, negative=0, nlobes=2) {
292 plusth = negative * 1.0;
293 protr = interlock_fine + interlock_sq_adj;
296 z1 = -tile_th/2 - protr / interlock_fine_slope;
297 z3 = -tile_th/2 + protr / interlock_fine_slope;
299 negsign = negative ? -1 : +1;
300 yprotr = negsign * protr;
302 INREFFRAME(left_cnr, right_cnr) {
303 for (vsect = [ // zs0 zs1 ys0, ys1
304 [ -tile_th-plusth, plusth, 0, 0],
305 [ z1, z2, 0, yprotr],
306 [ z2, z3, yprotr, 0],
316 [ 0,1, -sl, -ys0 + negsign*interlock_sq_adj ],
320 linear_extrude(height=zsd, convexity=10)
321 InterlockEdgePlan(negative, nlobes, length, !!ysd);
326 function TestPiece_holes2corners(holes) =
327 [ holes[0] + thehd_bl,
330 holes[0] + thehd_tl ];
332 module TestPiece1(){ ////toplevel
336 corners = TestPiece_holes2corners(holes);
337 rcs = [corners[0], corners[1]];
340 TileBase(corners[0], corners[2]);
342 RoundEdge(corners[0], corners[1]);
343 RoundEdge(corners[3], corners[0]);
345 InterlockEdge(corners[1], corners[2], 1, nlobes=1);
351 module TestPiece2(){ ////toplevel
355 corners = TestPiece_holes2corners(holes);
356 TileBase(corners[0], corners[2]);
358 RoundEdge(corners[0], corners[1]);
359 InterlockEdge(corners[3], corners[0], 0, nlobes=1);
362 module TestDemo(){ ////toplevel
363 translate([ -thehd[0], 0 ])
366 translate([ +thehd[0] + demo_slop, 0 ])
370 module Machine_Arm(){
371 ysz = cutout_l_end_y_total;
372 // assume the round end is arc of a circle
373 chordlen = dist2d([0,0], [ cutout_l_end_y, cutout_l_end_curve ]);
374 endrad = cutout_l_end_y / cutout_l_end_curve * chordlen;
376 translate([0,0,-30]) linear_extrude(height=60) {
377 translate(tile01_tr + [0, (-cutout_tile01_y + cutout_tile11_y)/2]) {
379 translate([-100, -ysz/2])
381 translate([ endrad - cutout_tile11_x - cutout_l_end_x_slop, 0 ])
382 circle(r=endrad, $fa=0.01,$fd=5);
388 module Machine_Profile(){
389 first_rear = machine_rear_profile[0];
390 first_front = machine_front_profile[len(machine_front_profile)-1];
391 below_point = 0.5 * ( first_rear + first_front ) + [ 0, -10 ];
392 pol = concat( machine_rear_profile,
394 machine_front_profile);
395 skew_angle = atan2( first_front[1] - first_rear[1],
396 first_front[0] - first_rear[0] );
397 echo(below_point, pol, skew_angle);
402 rotate([0,0, -skew_angle ]){
403 //translate( - first_front )
411 module Machine_RearProfile(){
414 translate([ -200 + machine_rear_to_front/2, -100 ]) {
420 module Machine_Rear(){ ////toplevel
421 translate([ tile01_tr[0] - cutout_l_end_x + rearedge_len,
425 translate([ -reartablet_x,
429 cube([ reartablet_x+1,
433 translate([ tile01_tr[0] - cutout_l_end_x + rearedge_len,
436 translate([ rearcurve_strt_len,
443 rotate([0,-90,0])rotate([0,0,-90]){
444 linear_extrude(height= rearcurve_strt_len + 1)
445 Machine_RearProfile();
450 rearcurve_double_inrad ]) {
453 rotate_extrude(convexity=10, $fn=32) {
454 rotate([0,0,90]) translate([ 0,
455 -rearcurve_double_inrad ]) {
456 Machine_RearProfile();
461 translate([0,-75,0]) cube([150,150,150]);
468 module Machine(){ ////toplevel
473 function Rectangle_corners(c0, sz) =
474 // returns the corners of a rectangle from c0 to c0+sz
475 // if sz is positive, the corners are anticlockwise starting with c0
478 c0 + [ sz[0], sz[1] ],
481 function Rectangle_corners2posts(c) =
487 module Rectangle_TileBase(c) { TileBase(c[0], c[2]); }
489 function Posts_interpolate_one(c0,c1) = [c0, (c0+c1)/2, c1];
492 m4_dnl c is from Rectangle_corners and
493 m4_dnl ix is a corner number
494 m4_dnl expands to two comma-separated corners:
495 m4_dnl that denoted by ix, and the next one anticlockwise
496 m4_define(`R_EDGE',`$1[$2],$1[(($2)+1)%4]')
498 module Tile02(){ ////toplevel
500 c0 = tile02_tr + -sz;
501 c = Rectangle_corners(c0, sz);
502 posts = Rectangle_corners2posts(c);
506 Rectangle_TileBase(c);
508 RoundEdge(R_EDGE(c,0));
509 RoundEdge(R_EDGE(c,3));
510 InterlockEdge(R_EDGE(c,2), 0);
512 InterlockEdge(R_EDGE(c,1), 1);
518 module Tile12(){ ////toplevel
520 c0 = tile02_tr + [-sz[0], 0];
521 c = Rectangle_corners(c0, sz);
522 posts = Rectangle_corners2posts(c);
526 Rectangle_TileBase(c);
528 RoundEdge(R_EDGE(c,2));
529 RoundEdge(R_EDGE(c,3));
531 InterlockEdge(R_EDGE(c,0), 1);
532 InterlockEdge(R_EDGE(c,1), 1);
538 tile_01_11_cnr = tile01_tr + [-cutout_tile11_x, 0];
539 tile_11_10_cnr = tile01_tr + [0, cutout_tile11_y];
541 module Tile11(){ ////toplevel
543 c0 = tile02_tr + [0,0];
544 c = Rectangle_corners(c0, sz);
545 cnr_posts = Rectangle_corners2posts(c);
547 Posts_interpolate_one(cnr_posts[0],
548 cnr_posts[1] - [cutout_tile11_x, 0]),
549 [ cnr_posts[1] + [0, cutout_tile11_y],
555 Rectangle_TileBase(c);
557 RoundEdge(R_EDGE(c,2));
558 InterlockEdge(R_EDGE(c,3));
560 InterlockEdge(c[0], tile_01_11_cnr, 1);
561 InterlockEdge(tile_11_10_cnr, c[2], 1);
566 tile_01_00_cnr = tile01_tr + [0, -cutout_tile01_y];
568 module Tile01(){ ////toplevel
570 c0 = tile02_tr + [0,-sz[1]];
571 c = Rectangle_corners(c0, sz);
572 cnr_posts = Rectangle_corners2posts(c);
574 Posts_interpolate_one(R_EDGE(cnr_posts,0)),
575 [ cnr_posts[2] + [0, -cutout_tile01_y] ],
576 Posts_interpolate_one(cnr_posts[2] - [cutout_tile11_x, 0],
581 Rectangle_TileBase(c);
583 RoundEdge(R_EDGE(c,0));
584 InterlockEdge(tile_01_11_cnr, c[3]);
585 InterlockEdge(R_EDGE(c,3));
587 InterlockEdge(c[1], tile_01_00_cnr, 1);
592 module Tile10(){ ////toplevel
594 c0 = tile02_tr + [sz[0],0];
595 c = Rectangle_corners(c0, sz);
596 cnr_posts = Rectangle_corners2posts(c);
597 cty = cutout_tile11_y;
598 rcy = cty + rearcurve_avoid_y;
599 posts = [ cnr_posts[0] + [ 0, cty ],
600 cnr_posts[1] + [ -sz[1] + rearedge_len - cutout_l_end_x, cty ],
601 cnr_posts[1] + [ 0, rcy ],
607 Rectangle_TileBase(c);
609 RoundEdge(R_EDGE(c,1));
610 RoundEdge(R_EDGE(c,2));
611 InterlockEdge(c[3], tile_11_10_cnr);
619 module Demo(){ ////toplevel
620 translate(demo_slop*[-2,1]) color("blue") Tile12();
621 translate(demo_slop*[-2,0]) color("red") Tile02();
622 translate(demo_slop*[-2,1]) color("orange") Tile11();
623 translate(demo_slop*[-2,0]) color("purple") Tile01();
624 translate(demo_slop*[-3,1]) color("blue") Tile10();
633 //Machine_RearProfile();