|
| 1 | +p_x = 20; // side length of puzzle piece |
| 2 | +p_y = 25; // side length of puzzle piece |
| 3 | +p_z = 2; // height of puzzle piece |
| 4 | +d = 0.5; // distance between puzzle pieces |
| 5 | +h_s = 0.35; // handle sizes |
| 6 | +h_d = 0.1; // handle distance |
| 7 | +amount = [1, 4]; // how many pieces one wants |
| 8 | +$fn = 50; |
| 9 | + |
| 10 | + |
| 11 | +module piece(){ |
| 12 | +difference(){ |
| 13 | + translate([d/2, d/2]) cube([p_x -d, p_y -d, p_z]); |
| 14 | + translate([p_x * h_d, p_y * 0.5]) resize([p_x * h_s +d, p_y * h_s +d]) |
| 15 | + cylinder(p_z*3, 10, 10, true); |
| 16 | + translate([p_x * 0.5, p_y * h_d]) resize([p_x * h_s +d, p_y * h_s +d]) |
| 17 | + cylinder(p_z*3, 10, 10, true); |
| 18 | +} |
| 19 | + translate([p_x * (h_d + 1), p_y * 0.5, p_z/2]) |
| 20 | + resize([p_x * h_s -d, p_y * h_s - d]) |
| 21 | + cylinder(p_z, 10, 10, true); |
| 22 | + translate([p_x * 0.5, p_y * (h_d + 1), p_z/2]) |
| 23 | + resize([p_x * h_s -d, p_y * h_s - d]) |
| 24 | + cylinder(p_z, 10, 10, true); |
| 25 | + |
| 26 | +} |
| 27 | + |
| 28 | +module puzzle() |
| 29 | +for (x= [0 : amount[0]-1], y = [0 : amount[1]-1]) |
| 30 | + translate([x * p_x, y * p_y]) piece(); |
| 31 | + |
| 32 | +puzzle(); |
| 33 | + |
0 commit comments