create deck scad for mounting everything
authordaniel watson <ozzloy@gmail.com>
Fri, 5 Sep 2014 07:08:32 +0000 (00:08 -0700)
committerdaniel watson <ozzloy@gmail.com>
Fri, 5 Sep 2014 07:08:32 +0000 (00:08 -0700)
3d-printables/deck.scad [new file with mode: 0644]

diff --git a/3d-printables/deck.scad b/3d-printables/deck.scad
new file mode 100644 (file)
index 0000000..67e44c6
--- /dev/null
@@ -0,0 +1,51 @@
+// challenge-bot
+// GNU AGPLv3 (or later at your option)
+// project available at these locations:
+// https://gitorious.org/ozzloy/challenge-bot
+// https://github.com/waynegramlich/challenge-bot
+
+// all measurements are in mm unless stated otherwise
+
+  // metric version of deck:
+deck_length = 200;
+deck_width = deck_length;
+deck_depth = 5;
+deck_pitch = 10;
+deck_grid_hole = 3;
+deck_hole_type = "square";
+
+  /*
+    // imperial version of deck
+deck_length = 203.2; // 8 inches
+deck_width = deck_length;
+deck_depth = 25.4 * 3 / 16; // 3 / 16 of an inch
+deck_pitch = 25.4; // 1 inch
+deck_grid_hole = 6.35 / 2; // 1/4 inch diameter, 1/8 inch radius
+deck_hole_type = "circle";
+  */
+
+module deck_2d(width, length, pitch, hole, hole_type, center=false){
+  center_width_offset = center ? -(width / 2): 0;
+  center_length_offset = center ? -(length / 2): 0;
+  translate([center_width_offset, center_length_offset]){
+    difference(){
+      square([width, length]);
+      for (y = [0:floor(length / pitch) - 1],
+           x = [0:floor(width / pitch) - 1]){
+        translate([pitch * (x + 0.5), pitch * (y + 0.5)]){
+          if (hole_type == "circle"){
+            circle(hole, center = true);}
+          else if (hole_type == "square") {
+            square(hole, center = true);}
+          else {
+            echo(str("don't know the hole type: ", hole_type));}}}}}}
+
+module deck(width, length, depth, pitch, hole, hole_type, center=false){
+  linear_extrude (height = depth){
+    deck_2d(width, length, pitch, hole, hole_type, center);}}
+
+deck_2d(deck_width,
+        deck_length,
+        deck_pitch,
+        deck_grid_hole,
+        deck_hole_type);