| 1 | // challenge-bot |
| 2 | // GNU AGPLv3 (or later at your option) |
| 3 | // project available at these locations: |
| 4 | // https://gitorious.org/ozzloy/challenge-bot |
| 5 | // https://github.com/waynegramlich/challenge-bot |
| 6 | |
| 7 | // all measurements are in mm unless stated otherwise |
| 8 | |
| 9 | // metric version of deck: |
| 10 | deck_length = 200; |
| 11 | deck_width = deck_length; |
| 12 | deck_depth = 5; |
| 13 | deck_pitch = 10; |
| 14 | deck_grid_hole = 3; |
| 15 | deck_hole_type = "square"; |
| 16 | |
| 17 | /* |
| 18 | // imperial version of deck |
| 19 | deck_length = 203.2; // 8 inches |
| 20 | deck_width = deck_length; |
| 21 | deck_depth = 25.4 * 3 / 16; // 3 / 16 of an inch |
| 22 | deck_pitch = 25.4; // 1 inch |
| 23 | deck_grid_hole = 6.35 / 2; // 1/4 inch diameter, 1/8 inch radius |
| 24 | deck_hole_type = "circle"; |
| 25 | */ |
| 26 | |
| 27 | module deck_2d(width, length, pitch, hole, hole_type, center=false){ |
| 28 | center_width_offset = center ? -(width / 2): 0; |
| 29 | center_length_offset = center ? -(length / 2): 0; |
| 30 | translate([center_width_offset, center_length_offset]){ |
| 31 | difference(){ |
| 32 | square([width, length]); |
| 33 | for (y = [0:floor(length / pitch) - 1], |
| 34 | x = [0:floor(width / pitch) - 1]){ |
| 35 | translate([pitch * (x + 0.5), pitch * (y + 0.5)]){ |
| 36 | if (hole_type == "circle"){ |
| 37 | circle(hole, center = true);} |
| 38 | else if (hole_type == "square") { |
| 39 | square(hole, center = true);} |
| 40 | else { |
| 41 | echo(str("don't know the hole type: ", hole_type));}}}}}} |
| 42 | |
| 43 | module deck(width, length, depth, pitch, hole, hole_type, center=false){ |
| 44 | linear_extrude (height = depth){ |
| 45 | deck_2d(width, length, pitch, hole, hole_type, center);}} |
| 46 | |
| 47 | deck_2d(deck_width, |
| 48 | deck_length, |
| 49 | deck_pitch, |
| 50 | deck_grid_hole, |
| 51 | deck_hole_type); |