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;
83 // front and rear curves
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
127 first_front = machine_front_profile[len(machine_front_profile)-1];
132 cylinder(r= post_dia/2, h= tile_th + ply_th - post_shorter);
133 translate([0,0, tile_th]) {
134 cylinder(r= screw_big_dia/2, h= screw_big_len);
135 cylinder(r= screw_dia/2, h= ply_th, $fn=20);
139 tsz = tile_hard_edge_hole_dist - test_edge + 1;
140 translate([0,0, tile_th/2]) {
141 cube([post_dia, tsz*2, tile_th], center=true);
142 cube([tsz*2, post_dia, tile_th], center=true);
148 module Posts(posts) {
150 translate(concat(p, [0]))
155 module TileBase(botleft, topright){
156 size = topright - botleft;
157 botleft_post = botleft + thehd_tr;
158 topright_post = topright + thehd_bl;
161 translate(concat(botleft, [0]))
162 cube(concat(size, [tile_th]));
164 translate( concat(botleft_post, [ -tile_th ])
165 + 0.5 * [ post_dia, post_dia, 0 ] )
166 Commitid_BestCount_M( topright_post-botleft_post
167 + [-post_dia,-post_dia]
171 translate( concat(botleft + [thehd[0], 0], [0]) )
172 Commitid_BestCount([ size[0] - thehd[0]*2, thehd[1] ]);
175 translate(concat(botleft + [test_edge,test_edge], [test_tile_th]))
176 cube(concat(size - [test_edge,test_edge]*2, [tile_th]));
177 translate(concat(botleft_post, [-1]))
178 cube(concat(topright_post-botleft_post, [tile_th+2]));
182 cube(max(test_edge, tile_hard_edge_hole_dist)*2, center=true);
189 m4_dnl INREFFRAME(left_cnr, right_cnr, morevars) { body; }
190 m4_define(`INREFFRAME',`
191 length_vec = ($2) - ($1);
192 length = dist2d([0,0], length_vec);
193 length_uvec = length_vec / length;
194 ortho_uvec = [ -length_uvec[1], length_uvec[0] ];
195 m = [ [ length_uvec[0], ortho_uvec[0], 0, ($1)[0], ],
196 [ length_uvec[1], ortho_uvec[1], 0, ($1)[1], ],
203 m4_dnl INREFFRAME(left_cnr, right_cnr, morevars)
204 m4_dnl INREFFRAME_EDGE { body; }
205 m4_define(`INREFFRAME_EDGE',`
206 translate([0,0, -round_edge_rad])
209 module RoundEdge(left_cnr, right_cnr) {
210 INREFFRAME(left_cnr, right_cnr)
214 cylinder(r= round_edge_rad, h= length, $fn=50);
215 translate([-1, 0, -20])
216 cube([length+2, 20, 20]);
221 module RoundCornerCut(ci) {
222 // ci should be [this_cnr, right_cnr]
223 // where right_cnr is to the right (ie, anticlockwise)
226 offr= round_cnr_rad - round_edge_rad;
227 INREFFRAME(this_cnr, right_cnr) INREFFRAME_EDGE {
229 cube(offr*2 - 0.1, center=true);
230 translate([offr, offr, 0])
231 cylinder(center=true, h=20, r= offr);
236 module RoundCornerAdd(ci) {
239 bigr = round_cnr_rad - round_edge_rad;
240 INREFFRAME(this_cnr, right_cnr) INREFFRAME_EDGE {
242 cube(bigr*2 + 0.1, center=true);
243 translate([bigr, bigr, 0])
244 rotate_extrude(convexity=10, $fn=50)
247 circle(r= round_edge_rad, $fn=50);
255 module InterlockLobePlan(negative) {
256 r = negative ? interlock_negative_rad : interlock_rad;
257 ymir = negative ? 0 : 1;
261 translate([thehd[0], 0]){
265 translate([-dx, -0.1])
266 square([ dx*2, r/2 + 0.1 ]);
268 translate([ xi*dx, r ])
276 module InterlockEdgePlan(negative, nlobes, length, dosquare=true) {
277 for (lobei = [ 0 : nlobes-1 ]) {
278 lobex = (length - thehd[0]*2) * (lobei ? lobei / (nlobes-1) : 0);
279 translate([lobex, 0, 0]) {
280 InterlockLobePlan(negative);
286 slotshorter = negative ? -0.1 : interlock_fine_lenslop;
287 mirror([0, negative])
288 translate([slotshorter, iadj])
289 square([length - slotshorter*2, interlock_fine + iadj*2]);
293 module InterlockEdge(left_cnr, right_cnr, negative=0, nlobes=2) {
294 plusth = negative * 1.0;
295 protr = interlock_fine + interlock_sq_adj;
298 z1 = -tile_th/2 - protr / interlock_fine_slope;
299 z3 = -tile_th/2 + protr / interlock_fine_slope;
301 negsign = negative ? -1 : +1;
302 yprotr = negsign * protr;
304 INREFFRAME(left_cnr, right_cnr) {
305 for (vsect = [ // zs0 zs1 ys0, ys1
306 [ -tile_th-plusth, plusth, 0, 0],
307 [ z1, z2, 0, yprotr],
308 [ z2, z3, yprotr, 0],
318 [ 0,1, -sl, -ys0 + negsign*interlock_sq_adj ],
322 linear_extrude(height=zsd, convexity=10)
323 InterlockEdgePlan(negative, nlobes, length, !!ysd);
328 function TestPiece_holes2corners(holes) =
329 [ holes[0] + thehd_bl,
332 holes[0] + thehd_tl ];
334 module TestPiece1(){ ////toplevel
338 corners = TestPiece_holes2corners(holes);
339 rcs = [corners[0], corners[1]];
342 TileBase(corners[0], corners[2]);
344 RoundEdge(corners[0], corners[1]);
345 RoundEdge(corners[3], corners[0]);
347 InterlockEdge(corners[1], corners[2], 1, nlobes=1);
353 module TestPiece2(){ ////toplevel
357 corners = TestPiece_holes2corners(holes);
358 TileBase(corners[0], corners[2]);
360 RoundEdge(corners[0], corners[1]);
361 InterlockEdge(corners[3], corners[0], 0, nlobes=1);
364 module TestDemo(){ ////toplevel
365 translate([ -thehd[0], 0 ])
368 translate([ +thehd[0] + demo_slop, 0 ])
372 module Machine_Arm(){
373 ysz = cutout_l_end_y_total;
374 // assume the round end is arc of a circle
375 chordlen = dist2d([0,0], [ cutout_l_end_y, cutout_l_end_curve ]);
376 endrad = cutout_l_end_y / cutout_l_end_curve * chordlen;
378 translate([0,0,-30]) linear_extrude(height=60) {
379 translate(tile01_tr + [0, (-cutout_tile01_y + cutout_tile11_y)/2]) {
381 translate([-100, -ysz/2])
383 translate([ endrad - cutout_tile11_x - cutout_l_end_x_slop, 0 ])
384 circle(r=endrad, $fa=0.01,$fd=5);
390 module Machine_Profile(){
391 first_rear = machine_rear_profile[0];
392 below_point = 0.5 * ( first_rear + first_front ) + [ 0, -10 ];
393 pol = concat( machine_rear_profile,
395 machine_front_profile);
396 skew_angle = atan2( first_front[1] - first_rear[1],
397 first_front[0] - first_rear[0] );
398 echo(below_point, pol, skew_angle);
403 rotate([0,0, -skew_angle ]){
404 //translate( - first_front )
412 module Machine_RearProfile(){
415 translate([ -200 + machine_rear_to_front/2, -100 ]) {
421 module Machine_Curves(){ ////toplevel
422 translate([ tile01_tr[0] - cutout_l_end_x + rearedge_len,
426 translate([ -reartablet_x,
430 cube([ reartablet_x+1,
434 translate([ tile01_tr[0] - cutout_l_end_x + rearedge_len,
437 translate([ rearcurve_strt_len,
444 rotate([0,-90,0])rotate([0,0,-90]){
445 linear_extrude(height= rearcurve_strt_len + 1)
446 Machine_RearProfile();
451 rearcurve_double_inrad ]) {
454 rotate_extrude(convexity=10, $fn=32) {
455 rotate([0,0,90]) translate([ 0,
456 -rearcurve_double_inrad ]) {
457 Machine_RearProfile();
462 translate([0,-75,0]) cube([150,150,150]);
469 module Machine(){ ////toplevel
474 function Rectangle_corners(c0, sz) =
475 // returns the corners of a rectangle from c0 to c0+sz
476 // if sz is positive, the corners are anticlockwise starting with c0
479 c0 + [ sz[0], sz[1] ],
482 function Rectangle_corners2posts(c) =
488 module Rectangle_TileBase(c) { TileBase(c[0], c[2]); }
490 function Posts_interpolate_one(c0,c1) = [c0, (c0+c1)/2, c1];
493 m4_dnl c is from Rectangle_corners and
494 m4_dnl ix is a corner number
495 m4_dnl expands to two comma-separated corners:
496 m4_dnl that denoted by ix, and the next one anticlockwise
497 m4_define(`R_EDGE',`$1[$2],$1[(($2)+1)%4]')
499 module Tile02(){ ////toplevel
501 c0 = tile02_tr + -sz;
502 c = Rectangle_corners(c0, sz);
503 posts = Rectangle_corners2posts(c);
507 Rectangle_TileBase(c);
509 RoundEdge(R_EDGE(c,0));
510 RoundEdge(R_EDGE(c,3));
511 InterlockEdge(R_EDGE(c,2), 0);
513 InterlockEdge(R_EDGE(c,1), 1);
519 module Tile12(){ ////toplevel
521 c0 = tile02_tr + [-sz[0], 0];
522 c = Rectangle_corners(c0, sz);
523 posts = Rectangle_corners2posts(c);
527 Rectangle_TileBase(c);
529 RoundEdge(R_EDGE(c,2));
530 RoundEdge(R_EDGE(c,3));
532 InterlockEdge(R_EDGE(c,0), 1);
533 InterlockEdge(R_EDGE(c,1), 1);
539 tile_01_11_cnr = tile01_tr + [-cutout_tile11_x, 0];
540 tile_11_10_cnr = tile01_tr + [0, cutout_tile11_y];
542 module Tile11(){ ////toplevel
544 c0 = tile02_tr + [0,0];
545 c = Rectangle_corners(c0, sz);
546 cnr_posts = Rectangle_corners2posts(c);
548 Posts_interpolate_one(cnr_posts[0],
549 cnr_posts[1] - [cutout_tile11_x, 0]),
550 [ cnr_posts[1] + [0, cutout_tile11_y],
556 Rectangle_TileBase(c);
558 RoundEdge(R_EDGE(c,2));
559 InterlockEdge(R_EDGE(c,3));
561 InterlockEdge(c[0], tile_01_11_cnr, 1);
562 InterlockEdge(tile_11_10_cnr, c[2], 1);
567 tile_01_00_cnr = tile01_tr + [0, -cutout_tile01_y];
569 module Tile01(){ ////toplevel
571 c0 = tile02_tr + [0,-sz[1]];
572 c = Rectangle_corners(c0, sz);
573 cnr_posts = Rectangle_corners2posts(c);
575 Posts_interpolate_one(R_EDGE(cnr_posts,0)),
576 [ cnr_posts[2] + [0, -cutout_tile01_y] ],
577 Posts_interpolate_one(cnr_posts[2] - [cutout_tile11_x, 0],
582 Rectangle_TileBase(c);
584 RoundEdge(R_EDGE(c,0));
585 InterlockEdge(tile_01_11_cnr, c[3]);
586 InterlockEdge(R_EDGE(c,3));
588 InterlockEdge(c[1], tile_01_00_cnr, 1);
593 module Tile10(){ ////toplevel
595 c0 = tile02_tr + [sz[0],0];
596 c = Rectangle_corners(c0, sz);
597 cnr_posts = Rectangle_corners2posts(c);
598 cty = cutout_tile11_y;
599 rcy = cty + rearcurve_avoid_y;
600 posts = [ cnr_posts[0] + [ 0, cty ],
601 cnr_posts[1] + [ -sz[1] + rearedge_len - cutout_l_end_x, cty ],
602 cnr_posts[1] + [ 0, rcy ],
608 Rectangle_TileBase(c);
610 RoundEdge(R_EDGE(c,1));
611 RoundEdge(R_EDGE(c,2));
612 InterlockEdge(c[3], tile_11_10_cnr);
620 module Demo(){ ////toplevel
621 translate(demo_slop*[-2,1]) color("blue") Tile12();
622 translate(demo_slop*[-2,0]) color("red") Tile02();
623 translate(demo_slop*[-2,1]) color("orange") Tile11();
624 translate(demo_slop*[-2,0]) color("purple") Tile01();
625 translate(demo_slop*[-3,1]) color("blue") Tile10();
634 //Machine_RearProfile();