define wiring in separate file
[challenge-bot] / 3d-printables / deck-data.scad
... / ...
CommitLineData
1/*
2 Copyright (C) 2015 Daniel Watson
3 See the end of the file for license conditions.
4*/
5// challenge-bot
6// GNU AGPLv3 (or later at your option)
7// project available here:
8// https://challenge-bot.com/
9
10// all measurements are in mm unless stated otherwise
11
12// metric version of deck:
13deck_length = 250;
14deck_width = deck_length;
15deck_depth = 5;
16deck_pitch = 10;
17deck_grid_hole = 3;
18deck_hole_type = "square";
19deck_centered = true;
20
21/*
22 // imperial version of deck
23deck_length = 203.2; // 8 inches
24deck_width = deck_length;
25deck_depth = 25.4 * 3 / 16; // 3 / 16 of an inch
26deck_pitch = 25.4; // 1 inch
27deck_grid_hole = 6.35 / 2; // 1/4 inch diameter, 1/8 inch radius
28deck_hole_type = "circle";
29*/
30
31module deck_2d(width, length, pitch, hole, hole_type, center = false) {
32 center_width_offset = center ? -(width / 2) : 0;
33 center_length_offset = center ? -(length / 2) : 0;
34 translate([center_width_offset, center_length_offset]) {
35 difference() {
36 square([width, length]);
37 for (y = [0:floor(length / pitch) - 1],
38 x = [0:floor(width / pitch) - 1]) {
39 translate([pitch * (x + 0.5), pitch * (y + 0.5)]) {
40 if (hole_type == "circle") {
41 circle(hole, center = true); }
42 else if (hole_type == "square") {
43 square(hole, center = true); }
44 else {
45 echo(str("don't know the hole type: ", hole_type)); } } } } } }
46
47module deck(width, length, depth, pitch, hole, hole_type, center = false) {
48 linear_extrude(height = depth) {
49 deck_2d(width, length, pitch, hole, hole_type, center); } }
50
51/*
52 This file is part of challenge-bot.
53
54 Challenge-bot is free software: you can redistribute it and/or modify
55 it under the terms of the GNU Affero General Public License as published by
56 the Free Software Foundation, either version 3 of the License, or
57 (at your option) any later version.
58
59 GNU Affero Emacs is distributed in the hope that it will be useful,
60 but WITHOUT ANY WARRANTY; without even the implied warranty of
61 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
62 GNU Affero General Public License for more details.
63
64 You should have received a copy of the GNU Affero General Public License
65 along with challenge-bot. If not, see <http://www.gnu.org/licenses/>.
66*/