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;
63 ply_edge_hole_dist = ply_edge_min + ply_hole_dia/2;
65 echo(str("HOLES IN PLY ctr dist from PLY edge = ", ply_edge_hole_dist));
67 hole_slop = (ply_hole_dia - post_dia)/2;
68 tile_hard_edge_hole_dist = ply_edge_hole_dist + hole_slop;
70 echo(str("HOLES IN PLY ctr dist from TILE HARD edge = ",
71 tile_hard_edge_hole_dist));
73 echo(str("HOLES IN PLY ctr dist from TILE ROUND edge = ",
74 tile_hard_edge_hole_dist + round_edge_rad));
76 thehd = [ tile_hard_edge_hole_dist, tile_hard_edge_hole_dist ];
78 thehd_tl = [ -thehd_tr[0], thehd_tr[1] ];
82 interlock_rad = interlock_dia/2;
83 interlock_negative_rad = interlock_rad + 0.125;
85 interlock_sq_adj = 0.2; // arbitrary
90 cylinder(r= post_dia/2, h= tile_th + ply_th - post_shorter);
91 translate([0,0, tile_th]) {
92 cylinder(r= screw_big_dia/2, h= screw_big_len);
93 cylinder(r= screw_dia/2, h= ply_th, $fn=20);
97 tsz = tile_hard_edge_hole_dist - test_edge + 1;
98 translate([0,0, tile_th/2]) {
99 cube([post_dia, tsz*2, tile_th], center=true);
100 cube([tsz*2, post_dia, tile_th], center=true);
106 module Posts(posts) {
108 translate(concat(p, [0]))
113 module TileBase(botleft, topright){
114 size = topright - botleft;
115 botleft_post = botleft + thehd_tr;
116 topright_post = topright + thehd_bl;
119 translate(concat(botleft, [0]))
120 cube(concat(size, [tile_th]));
122 translate( concat(botleft_post, [ -tile_th ])
123 + 0.5 * [ post_dia, post_dia, 0 ] )
124 Commitid_BestCount_M( topright_post-botleft_post
125 + [-post_dia,-post_dia]
129 translate( concat(botleft + [thehd[0], 0], [0]) )
130 Commitid_BestCount([ size[0] - thehd[0]*2, thehd[1] ]);
133 translate(concat(botleft + [test_edge,test_edge], [test_tile_th]))
134 cube(concat(size - [test_edge,test_edge]*2, [tile_th]));
135 translate(concat(botleft_post, [-1]))
136 cube(concat(topright_post-botleft_post, [tile_th+2]));
140 cube(max(test_edge, tile_hard_edge_hole_dist)*2, center=true);
147 m4_dnl INREFFRAME(left_cnr, right_cnr, morevars) { body; }
148 m4_define(`INREFFRAME',`
149 length_vec = ($2) - ($1);
150 length = dist2d([0,0], length_vec);
151 length_uvec = length_vec / length;
152 ortho_uvec = [ -length_uvec[1], length_uvec[0] ];
153 m = [ [ length_uvec[0], ortho_uvec[0], 0, ($1)[0], ],
154 [ length_uvec[1], ortho_uvec[1], 0, ($1)[1], ],
161 m4_dnl INREFFRAME(left_cnr, right_cnr, morevars)
162 m4_dnl INREFFRAME_EDGE { body; }
163 m4_define(`INREFFRAME_EDGE',`
164 translate([0,0, -round_edge_rad])
167 module RoundEdge(left_cnr, right_cnr) {
168 INREFFRAME(left_cnr, right_cnr)
172 cylinder(r= round_edge_rad, h= length, $fn=50);
173 translate([-1, 0, -20])
174 cube([length+2, 20, 20]);
179 module RoundCornerCut(ci) {
180 // ci should be [this_cnr, right_cnr]
181 // where right_cnr is to the right (ie, anticlockwise)
184 offr= round_cnr_rad - round_edge_rad;
185 INREFFRAME(this_cnr, right_cnr) INREFFRAME_EDGE {
187 cube(offr*2 - 0.1, center=true);
188 translate([offr, offr, 0])
189 cylinder(center=true, h=20, r= offr);
194 module RoundCornerAdd(ci) {
197 bigr = round_cnr_rad - round_edge_rad;
198 INREFFRAME(this_cnr, right_cnr) INREFFRAME_EDGE {
200 cube(bigr*2 + 0.1, center=true);
201 translate([bigr, bigr, 0])
202 rotate_extrude(convexity=10, $fn=50)
205 circle(r= round_edge_rad, $fn=50);
213 module InterlockLobePlan(negative) {
214 r = negative ? interlock_negative_rad : interlock_rad;
215 ymir = negative ? 0 : 1;
219 translate([thehd[0], 0]){
223 translate([-dx, -0.1])
224 square([ dx*2, r/2 + 0.1 ]);
226 translate([ xi*dx, r ])
234 module InterlockEdgePlan(negative, nlobes, length, dosquare=true) {
235 for (lobei = [ 0 : nlobes-1 ]) {
236 lobex = (length - thehd[0]*2) * (lobei ? lobei / (nlobes-1) : 0);
237 translate([lobex, 0, 0]) {
238 InterlockLobePlan(negative);
244 slotshorter = negative ? -0.1 : interlock_fine_lenslop;
245 mirror([0, negative])
246 translate([slotshorter, iadj])
247 square([length - slotshorter*2, interlock_fine + iadj*2]);
251 module InterlockEdge(left_cnr, right_cnr, negative=0, nlobes=2) {
252 plusth = negative * 1.0;
253 protr = interlock_fine + interlock_sq_adj;
256 z1 = -tile_th/2 - protr / interlock_fine_slope;
257 z3 = -tile_th/2 + protr / interlock_fine_slope;
259 negsign = negative ? -1 : +1;
260 yprotr = negsign * protr;
262 INREFFRAME(left_cnr, right_cnr) {
263 for (vsect = [ // zs0 zs1 ys0, ys1
264 [ -tile_th-plusth, plusth, 0, 0],
265 [ z1, z2, 0, yprotr],
266 [ z2, z3, yprotr, 0],
276 [ 0,1, -sl, -ys0 + negsign*interlock_sq_adj ],
280 linear_extrude(height=zsd, convexity=10)
281 InterlockEdgePlan(negative, nlobes, length, !!ysd);
286 function TestPiece_holes2corners(holes) =
287 [ holes[0] + thehd_bl,
290 holes[0] + thehd_tl ];
292 module TestPiece1(){ ////toplevel
296 corners = TestPiece_holes2corners(holes);
297 rcs = [corners[0], corners[1]];
300 TileBase(corners[0], corners[2]);
302 RoundEdge(corners[0], corners[1]);
303 RoundEdge(corners[3], corners[0]);
305 InterlockEdge(corners[1], corners[2], 1, nlobes=1);
311 module TestPiece2(){ ////toplevel
315 corners = TestPiece_holes2corners(holes);
316 TileBase(corners[0], corners[2]);
318 RoundEdge(corners[0], corners[1]);
319 InterlockEdge(corners[3], corners[0], 0, nlobes=1);
322 module TestDemo(){ ////toplevel
323 translate([ -thehd[0], 0 ])
326 translate([ +thehd[0] + demo_slop, 0 ])
330 module Machine_Arm(){
331 ysz = cutout_l_end_y_total;
332 // assume the round end is arc of a circle
333 chordlen = dist2d([0,0], [ cutout_l_end_y, cutout_l_end_curve ]);
334 endrad = cutout_l_end_y / cutout_l_end_curve * chordlen;
336 translate([0,0,-30]) linear_extrude(height=60) {
337 translate(tile01_tr + [0, (-cutout_tile01_y + cutout_tile11_y)/2]) {
339 translate([-100, -ysz/2])
341 translate([ endrad - cutout_tile11_x - cutout_l_end_x_slop, 0 ])
342 circle(r=endrad, $fa=0.01,$fd=5);
348 module Machine_Rear(){
349 big_rad = rearcurve_total_len - rearcurve_strt_len + rearcurve_rad;
350 small_rad = rearcurve_rad + rearcurve_rad_slop;
351 translate([ 250 + rearedge_len - cutout_l_end_y + big_rad,
359 cylinder(r = small_rad, h= rearcurve_strt_len);
364 big_rad - rearcurve_rad ]) {
367 rotate_extrude(convexity=10) {
370 circle(r= small_rad);
380 module Machine(){ ////toplevel
385 function Rectangle_corners(c0, sz) =
386 // returns the corners of a rectangle from c0 to c0+sz
387 // if sz is positive, the corners are anticlockwise starting with c0
390 c0 + [ sz[0], sz[1] ],
393 function Rectangle_corners2posts(c) =
399 module Rectangle_TileBase(c) { TileBase(c[0], c[2]); }
401 function Posts_interpolate_one(c0,c1) = [c0, (c0+c1)/2, c1];
404 m4_dnl c is from Rectangle_corners and
405 m4_dnl ix is a corner number
406 m4_dnl expands to two comma-separated corners:
407 m4_dnl that denoted by ix, and the next one anticlockwise
408 m4_define(`R_EDGE',`$1[$2],$1[(($2)+1)%4]')
410 module Tile02(){ ////toplevel
413 c = Rectangle_corners(c0, sz);
414 posts = Rectangle_corners2posts(c);
418 Rectangle_TileBase(c);
420 RoundEdge(R_EDGE(c,0));
421 RoundEdge(R_EDGE(c,3));
422 InterlockEdge(R_EDGE(c,2), 0);
424 InterlockEdge(R_EDGE(c,1), 1);
430 module Tile12(){ ////toplevel
433 c = Rectangle_corners(c0, sz);
434 posts = Rectangle_corners2posts(c);
438 Rectangle_TileBase(c);
440 RoundEdge(R_EDGE(c,2));
441 RoundEdge(R_EDGE(c,3));
443 InterlockEdge(R_EDGE(c,0), 1);
444 InterlockEdge(R_EDGE(c,1), 1);
450 tile_01_11_cnr = [250, 0] + [-cutout_tile11_x, 0];
451 tile_11_10_cnr = [250, 0] + [0, cutout_tile11_y];
453 module Tile11(){ ////toplevel
456 c = Rectangle_corners(c0, sz);
457 cnr_posts = Rectangle_corners2posts(c);
459 Posts_interpolate_one(cnr_posts[0],
460 cnr_posts[1] - [cutout_tile11_x, 0]),
461 [ cnr_posts[1] + [0, cutout_tile11_y],
467 Rectangle_TileBase(c);
469 RoundEdge(R_EDGE(c,2));
470 InterlockEdge(R_EDGE(c,3));
472 InterlockEdge(c[0], tile_01_11_cnr, 1);
473 InterlockEdge(tile_11_10_cnr, c[2], 1);
478 tile_01_00_cnr = [250, 0] + [0, -cutout_tile01_y];
480 module Tile01(){ ////toplevel
483 c = Rectangle_corners(c0, sz);
484 cnr_posts = Rectangle_corners2posts(c);
486 Posts_interpolate_one(R_EDGE(cnr_posts,0)),
487 [ cnr_posts[2] + [0, -cutout_tile01_y] ],
488 Posts_interpolate_one(cnr_posts[2] - [cutout_tile11_x, 0],
493 Rectangle_TileBase(c);
495 RoundEdge(R_EDGE(c,0));
496 InterlockEdge(tile_01_11_cnr, c[3]);
497 InterlockEdge(R_EDGE(c,3));
499 InterlockEdge(c[1], tile_01_00_cnr, 1);
504 module Demo(){ ////toplevel
505 translate(demo_slop*[-2,1]) color("blue") Tile12();
506 translate(demo_slop*[-2,0]) color("red") Tile02();
507 translate(demo_slop*[-2,1]) color("orange") Tile11();
508 translate(demo_slop*[-2,0]) color("purple") Tile01();