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;
88 rearcurve_strt_len = 65;
89 rearcurve_total_len = 84;
91 rearcurve_rad_slop = 0.75;
92 rearcurve_z_slop = 0.75;
94 rearcurve_avoid_y = 35;
96 rearcurve_double_inrad = 26.10 + 8.04;
106 ply_edge_hole_dist = ply_edge_min + ply_hole_dia/2;
108 echo(str("HOLES IN PLY ctr dist from PLY edge = ", ply_edge_hole_dist));
110 hole_slop = (ply_hole_dia - post_dia)/2;
111 tile_hard_edge_hole_dist = ply_edge_hole_dist + hole_slop;
113 echo(str("HOLES IN PLY ctr dist from TILE HARD edge = ",
114 tile_hard_edge_hole_dist));
116 echo(str("HOLES IN PLY ctr dist from TILE ROUND edge = ",
117 tile_hard_edge_hole_dist + round_edge_rad));
119 thehd = [ tile_hard_edge_hole_dist, tile_hard_edge_hole_dist ];
121 thehd_tl = [ -thehd_tr[0], thehd_tr[1] ];
122 thehd_bl = -thehd_tr;
123 thehd_br = -thehd_tl;
125 interlock_rad = interlock_dia/2;
126 interlock_negative_rad = interlock_rad + 0.125;
128 interlock_sq_adj = 0.2; // arbitrary
133 cylinder(r= post_dia/2, h= tile_th + ply_th - post_shorter);
134 translate([0,0, tile_th]) {
135 cylinder(r= screw_big_dia/2, h= screw_big_len);
136 cylinder(r= screw_dia/2, h= ply_th, $fn=20);
140 tsz = tile_hard_edge_hole_dist - test_edge + 1;
141 translate([0,0, tile_th/2]) {
142 cube([post_dia, tsz*2, tile_th], center=true);
143 cube([tsz*2, post_dia, tile_th], center=true);
149 module Posts(posts) {
151 translate(concat(p, [0]))
156 module TileBase(botleft, topright){
157 size = topright - botleft;
158 botleft_post = botleft + thehd_tr;
159 topright_post = topright + thehd_bl;
162 translate(concat(botleft, [0]))
163 cube(concat(size, [tile_th]));
165 translate( concat(botleft_post, [ -tile_th ])
166 + 0.5 * [ post_dia, post_dia, 0 ] )
167 Commitid_BestCount_M( topright_post-botleft_post
168 + [-post_dia,-post_dia]
172 translate( concat(botleft + [thehd[0], 0], [0]) )
173 Commitid_BestCount([ size[0] - thehd[0]*2, thehd[1] ]);
176 translate(concat(botleft + [test_edge,test_edge], [test_tile_th]))
177 cube(concat(size - [test_edge,test_edge]*2, [tile_th]));
178 translate(concat(botleft_post, [-1]))
179 cube(concat(topright_post-botleft_post, [tile_th+2]));
183 cube(max(test_edge, tile_hard_edge_hole_dist)*2, center=true);
190 m4_dnl INREFFRAME(left_cnr, right_cnr, morevars) { body; }
191 m4_define(`INREFFRAME',`
192 length_vec = ($2) - ($1);
193 length = dist2d([0,0], length_vec);
194 length_uvec = length_vec / length;
195 ortho_uvec = [ -length_uvec[1], length_uvec[0] ];
196 m = [ [ length_uvec[0], ortho_uvec[0], 0, ($1)[0], ],
197 [ length_uvec[1], ortho_uvec[1], 0, ($1)[1], ],
204 m4_dnl INREFFRAME(left_cnr, right_cnr, morevars)
205 m4_dnl INREFFRAME_EDGE { body; }
206 m4_define(`INREFFRAME_EDGE',`
207 translate([0,0, -round_edge_rad])
210 module RoundEdge(left_cnr, right_cnr) {
211 INREFFRAME(left_cnr, right_cnr)
215 cylinder(r= round_edge_rad, h= length, $fn=50);
216 translate([-1, 0, -20])
217 cube([length+2, 20, 20]);
222 module RoundCornerCut(ci) {
223 // ci should be [this_cnr, right_cnr]
224 // where right_cnr is to the right (ie, anticlockwise)
227 offr= round_cnr_rad - round_edge_rad;
228 INREFFRAME(this_cnr, right_cnr) INREFFRAME_EDGE {
230 cube(offr*2 - 0.1, center=true);
231 translate([offr, offr, 0])
232 cylinder(center=true, h=20, r= offr);
237 module RoundCornerAdd(ci) {
240 bigr = round_cnr_rad - round_edge_rad;
241 INREFFRAME(this_cnr, right_cnr) INREFFRAME_EDGE {
243 cube(bigr*2 + 0.1, center=true);
244 translate([bigr, bigr, 0])
245 rotate_extrude(convexity=10, $fn=50)
248 circle(r= round_edge_rad, $fn=50);
256 module InterlockLobePlan(negative) {
257 r = negative ? interlock_negative_rad : interlock_rad;
258 ymir = negative ? 0 : 1;
262 translate([thehd[0], 0]){
266 translate([-dx, -0.1])
267 square([ dx*2, r/2 + 0.1 ]);
269 translate([ xi*dx, r ])
277 module InterlockEdgePlan(negative, nlobes, length, dosquare=true) {
278 for (lobei = [ 0 : nlobes-1 ]) {
279 lobex = (length - thehd[0]*2) * (lobei ? lobei / (nlobes-1) : 0);
280 translate([lobex, 0, 0]) {
281 InterlockLobePlan(negative);
287 slotshorter = negative ? -0.1 : interlock_fine_lenslop;
288 mirror([0, negative])
289 translate([slotshorter, iadj])
290 square([length - slotshorter*2, interlock_fine + iadj*2]);
294 module InterlockEdge(left_cnr, right_cnr, negative=0, nlobes=2) {
295 plusth = negative * 1.0;
296 protr = interlock_fine + interlock_sq_adj;
299 z1 = -tile_th/2 - protr / interlock_fine_slope;
300 z3 = -tile_th/2 + protr / interlock_fine_slope;
302 negsign = negative ? -1 : +1;
303 yprotr = negsign * protr;
305 INREFFRAME(left_cnr, right_cnr) {
306 for (vsect = [ // zs0 zs1 ys0, ys1
307 [ -tile_th-plusth, plusth, 0, 0],
308 [ z1, z2, 0, yprotr],
309 [ z2, z3, yprotr, 0],
319 [ 0,1, -sl, -ys0 + negsign*interlock_sq_adj ],
323 linear_extrude(height=zsd, convexity=10)
324 InterlockEdgePlan(negative, nlobes, length, !!ysd);
329 function TestPiece_holes2corners(holes) =
330 [ holes[0] + thehd_bl,
333 holes[0] + thehd_tl ];
335 module TestPiece1(){ ////toplevel
339 corners = TestPiece_holes2corners(holes);
340 rcs = [corners[0], corners[1]];
343 TileBase(corners[0], corners[2]);
345 RoundEdge(corners[0], corners[1]);
346 RoundEdge(corners[3], corners[0]);
348 InterlockEdge(corners[1], corners[2], 1, nlobes=1);
354 module TestPiece2(){ ////toplevel
358 corners = TestPiece_holes2corners(holes);
359 TileBase(corners[0], corners[2]);
361 RoundEdge(corners[0], corners[1]);
362 InterlockEdge(corners[3], corners[0], 0, nlobes=1);
365 module TestDemo(){ ////toplevel
366 translate([ -thehd[0], 0 ])
369 translate([ +thehd[0] + demo_slop, 0 ])
373 module Machine_Arm(){
374 ysz = cutout_l_end_y_total;
375 // assume the round end is arc of a circle
376 chordlen = dist2d([0,0], [ cutout_l_end_y, cutout_l_end_curve ]);
377 endrad = cutout_l_end_y / cutout_l_end_curve * chordlen;
379 translate([0,0,-30]) linear_extrude(height=60) {
380 translate(tile01_tr + [0, (-cutout_tile01_y + cutout_tile11_y)/2]) {
382 translate([-100, -ysz/2])
384 translate([ endrad - cutout_tile11_x - cutout_l_end_x_slop, 0 ])
385 circle(r=endrad, $fa=0.01,$fd=5);
391 module Machine_Profile(){
392 first_rear = machine_rear_profile[0];
393 first_front = machine_front_profile[len(machine_front_profile)-1];
394 below_point = 0.5 * ( first_rear + first_front ) + [ 0, -10 ];
395 pol = concat( machine_rear_profile,
397 machine_front_profile);
398 skew_angle = atan2( first_front[1] - first_rear[1],
399 first_front[0] - first_rear[0] );
400 echo(below_point, pol, skew_angle);
405 rotate([0,0, -skew_angle ]){
406 //translate( - first_front )
414 module Machine_RearProfile(){
417 translate([ -200 + machine_rear_to_front/2, -100 ]) {
423 module Machine_Rear(){ ////toplevel
424 big_rad = rearcurve_total_len - rearcurve_strt_len + rearcurve_rad;
425 small_rad = rearcurve_rad + rearcurve_rad_slop;
426 translate([ tile01_tr[0] - cutout_l_end_x + rearedge_len,
430 translate([ -reartablet_x,
434 cube([ reartablet_x+1,
438 translate([ tile01_tr[0] - cutout_l_end_x + rearedge_len,
441 translate([ rearcurve_strt_len,
448 rotate([0,-90,0])rotate([0,0,-90]){
449 linear_extrude(height= rearcurve_strt_len + 1)
450 Machine_RearProfile();
455 rearcurve_double_inrad ]) {
458 rotate_extrude(convexity=10, $fn=32) {
459 rotate([0,0,90]) translate([ 0,
460 -rearcurve_double_inrad ]) {
461 Machine_RearProfile();
466 translate([0,-75,0]) cube([150,150,150]);
473 module Machine(){ ////toplevel
478 function Rectangle_corners(c0, sz) =
479 // returns the corners of a rectangle from c0 to c0+sz
480 // if sz is positive, the corners are anticlockwise starting with c0
483 c0 + [ sz[0], sz[1] ],
486 function Rectangle_corners2posts(c) =
492 module Rectangle_TileBase(c) { TileBase(c[0], c[2]); }
494 function Posts_interpolate_one(c0,c1) = [c0, (c0+c1)/2, c1];
497 m4_dnl c is from Rectangle_corners and
498 m4_dnl ix is a corner number
499 m4_dnl expands to two comma-separated corners:
500 m4_dnl that denoted by ix, and the next one anticlockwise
501 m4_define(`R_EDGE',`$1[$2],$1[(($2)+1)%4]')
503 module Tile02(){ ////toplevel
505 c0 = tile02_tr + -sz;
506 c = Rectangle_corners(c0, sz);
507 posts = Rectangle_corners2posts(c);
511 Rectangle_TileBase(c);
513 RoundEdge(R_EDGE(c,0));
514 RoundEdge(R_EDGE(c,3));
515 InterlockEdge(R_EDGE(c,2), 0);
517 InterlockEdge(R_EDGE(c,1), 1);
523 module Tile12(){ ////toplevel
525 c0 = tile02_tr + [-sz[0], 0];
526 c = Rectangle_corners(c0, sz);
527 posts = Rectangle_corners2posts(c);
531 Rectangle_TileBase(c);
533 RoundEdge(R_EDGE(c,2));
534 RoundEdge(R_EDGE(c,3));
536 InterlockEdge(R_EDGE(c,0), 1);
537 InterlockEdge(R_EDGE(c,1), 1);
543 tile_01_11_cnr = tile01_tr + [-cutout_tile11_x, 0];
544 tile_11_10_cnr = tile01_tr + [0, cutout_tile11_y];
546 module Tile11(){ ////toplevel
548 c0 = tile02_tr + [0,0];
549 c = Rectangle_corners(c0, sz);
550 cnr_posts = Rectangle_corners2posts(c);
552 Posts_interpolate_one(cnr_posts[0],
553 cnr_posts[1] - [cutout_tile11_x, 0]),
554 [ cnr_posts[1] + [0, cutout_tile11_y],
560 Rectangle_TileBase(c);
562 RoundEdge(R_EDGE(c,2));
563 InterlockEdge(R_EDGE(c,3));
565 InterlockEdge(c[0], tile_01_11_cnr, 1);
566 InterlockEdge(tile_11_10_cnr, c[2], 1);
571 tile_01_00_cnr = tile01_tr + [0, -cutout_tile01_y];
573 module Tile01(){ ////toplevel
575 c0 = tile02_tr + [0,-sz[1]];
576 c = Rectangle_corners(c0, sz);
577 cnr_posts = Rectangle_corners2posts(c);
579 Posts_interpolate_one(R_EDGE(cnr_posts,0)),
580 [ cnr_posts[2] + [0, -cutout_tile01_y] ],
581 Posts_interpolate_one(cnr_posts[2] - [cutout_tile11_x, 0],
586 Rectangle_TileBase(c);
588 RoundEdge(R_EDGE(c,0));
589 InterlockEdge(tile_01_11_cnr, c[3]);
590 InterlockEdge(R_EDGE(c,3));
592 InterlockEdge(c[1], tile_01_00_cnr, 1);
597 module Tile10(){ ////toplevel
599 c0 = tile02_tr + [sz[0],0];
600 c = Rectangle_corners(c0, sz);
601 cnr_posts = Rectangle_corners2posts(c);
602 cty = cutout_tile11_y;
603 rcy = cty + rearcurve_avoid_y;
604 posts = [ cnr_posts[0] + [ 0, cty ],
605 cnr_posts[1] + [ -sz[1] + rearedge_len - cutout_l_end_x, cty ],
606 cnr_posts[1] + [ 0, rcy ],
612 Rectangle_TileBase(c);
614 RoundEdge(R_EDGE(c,1));
615 RoundEdge(R_EDGE(c,2));
616 InterlockEdge(c[3], tile_11_10_cnr);
624 module Demo(){ ////toplevel
625 translate(demo_slop*[-2,1]) color("blue") Tile12();
626 translate(demo_slop*[-2,0]) color("red") Tile02();
627 translate(demo_slop*[-2,1]) color("orange") Tile11();
628 translate(demo_slop*[-2,0]) color("purple") Tile01();
629 translate(demo_slop*[-3,1]) color("blue") Tile10();
638 //Machine_RearProfile();