summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArmaan Bhojwani <me@armaanb.net>2021-01-26 13:53:28 -0500
committerArmaan Bhojwani <me@armaanb.net>2021-01-26 13:53:28 -0500
commit2bd920ab3db4e43ed2f85025220ece6b556e28f7 (patch)
treec91ee47123e72bccc920b76fcb7e116751a4b872
parentff2fd77bd330abf666df4dd01338d9daa91b747f (diff)
downloadatreides-2bd920ab3db4e43ed2f85025220ece6b556e28f7.tar.gz
Add preliminary OLED and joystick screw holes
In addition to some other code cleanup throughout
-rw-r--r--case.scad194
1 files changed, 117 insertions, 77 deletions
diff --git a/case.scad b/case.scad
index 17d493c..a5a0331 100644
--- a/case.scad
+++ b/case.scad
@@ -1,7 +1,15 @@
-/* All distances are in mm. */
+///////////////////////////////////////////////////////////////////////////////
+// Atreides case file, OpenSCAD laser cut format
+// Copyright 2014-2020 Phil Hagelberg, 2021 Armaan Bhojwani, GPLv3
+// All distances are in mm
+///////////////////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////////////////
+// VARIABLES
+///////////////////////////////////////////////////////////////////////////////
/* set output quality */
-$fn = 50;
+$fn = 100;
/* Distance between key centers. */
column_spacing = 19;
@@ -9,12 +17,11 @@ row_spacing = column_spacing;
/* This number should exceed row_spacing and column_spacing. The
default gives a 1mm = (20mm - 19mm) gap between keycaps and cuts in
- the top plate.*/
+ the top plate. */
key_hole_size = 20;
-/* rotation angle; the angle between the halves is twice this
- number */
-angle = 10;
+/* the angle between the halves is twice this number */
+angle = 15;
/* The radius of screw holes. Holes will be slightly bigger due
to the cut width. */
@@ -56,11 +63,17 @@ cable_hole_width = 12;
be zero. */
staggering_offsets = [0, 5, 11, 6, 3];
-/* Whether or not to split the spacer into quarters. */
-quarter_spacer = false;
+/* Width and height between screw holes of OLED */
+oled_width = 23;
+oled_height = 23;
+
+/* Width and height between screw holes of pointer */
+pointer_width = 20;
+pointer_height = 20;
-/* Where the top/bottom split of a quartered spacer will be. */
-spacer_quartering_offset = 60;
+///////////////////////////////////////////////////////////////////////////////
+// META MODULES
+///////////////////////////////////////////////////////////////////////////////
module rz(angle, center=undef) {
/* Rotate children `angle` degrees around `center`. */
@@ -109,17 +122,6 @@ module regular_key(position, size) {
}
}
-module thumb_key(position, size) {
- /* Create a hole for a 1x1.5 unit thumb key. */
- translate(position) {
- scale([1, 1.5]) {
- translate(-position) {
- regular_key(position, size);
- }
- }
- }
-}
-
module column (bottom_position, switch_holes, key_size=key_hole_size) {
/* Create a column of keys. */
translate(bottom_position) {
@@ -154,39 +156,18 @@ module add_hand_separation() {
}
}
-module right_half (switch_holes=true, key_size=key_hole_size) {
- /* Create switch holes or key holes for the right half of the
- keyboard. Different key_sizes are used in top_plate() and
- spacer(). */
- x_offset = 0.5 * row_spacing;
- y_offset = 0.5 * column_spacing;
- thumb_key_offset = y_offset + 0.5 * column_spacing;
- rotate_half() {
- add_hand_separation() {
- for (j=[0:(n_thumb_keys-1)]) {
- if (switch_holes == true) {
- switch_hole([x_offset + j*row_spacing, thumb_key_offset]);
- } else {
- thumb_key([x_offset + j*row_spacing, thumb_key_offset], key_size);
- }
- }
- for (j=[0:(n_cols-1)]) {
- column([x_offset + (j+n_thumb_keys)*row_spacing, y_offset + staggering_offsets[j]], switch_holes, key_size);
- }
- }
- }
-}
-
module screw_hole(radius, offset_radius, position, direction) {
/* Create a screw hole of radius `radius` at a location
`offset_radius` from `position`, (diagonally), in the direction
- `direction`. Oh, what a mess this is. */
- /* direction is the 2-element vector specifying to which side of
- position to move to, [-1, -1] for bottom left, etc. */
+ `direction`. Oh, what a mess this is.
- /* radius_offset is the offset in the x (or y) direction so that
+ direction is the 2-element vector specifying to which side of
+ position to move to, [-1, -1] for bottom left, etc.
+
+ radius_offset is the offset in the x (or y) direction so that
we're offset_radius from position */
radius_offset = offset_radius / sqrt(2);
+
/* key_hole_offset if the difference between key spacing and key
hole edge */
key_hole_offset = 0.5*(row_spacing - key_hole_size);
@@ -197,6 +178,52 @@ module screw_hole(radius, offset_radius, position, direction) {
}
}
+module oled_holes(hole_radius) {
+ translate([0,100]) {
+ translate([-oled_width/2,-oled_height/2]) {
+ translate([0, oled_height]) {
+ screw_hole(hole_radius, washer_radius);
+ }
+ translate([oled_width, oled_height]) {
+ screw_hole(hole_radius, washer_radius);
+ }
+ translate([oled_width, 0]) {
+ screw_hole(hole_radius, washer_radius);
+ }
+ screw_hole(hole_radius, washer_radius);
+ }
+ translate([0, -8]) {
+ square(oled_width-5, center=true);
+ }
+ }
+}
+
+module pointer_holes(hole_radius) {
+ translate([0, 65]) {
+ translate([-pointer_width/2,-pointer_height/2]) {
+ translate([0, pointer_height]) {
+ screw_hole(hole_radius, washer_radius);
+ }
+ translate([pointer_width, pointer_height]) {
+ screw_hole(hole_radius, washer_radius);
+ }
+ translate([pointer_width, 0]) {
+ screw_hole(hole_radius, washer_radius);
+ }
+ screw_hole(hole_radius, washer_radius);
+ }
+ translate([0, -12]) {
+ square(pointer_width-5, center=true);
+ }
+ }
+}
+
+module passthrough() {
+ translate([0, 75]) {
+ square(15, center=true);
+ }
+}
+
module right_screw_holes(hole_radius) {
/* coordinates of the back right screw hole before rotation... */
back_right = [(n_cols+n_thumb_keys)*row_spacing,
@@ -240,14 +267,42 @@ module screw_holes(hole_radius) {
mirror ([1,0,0]) { right_screw_holes(hole_radius); }
}
+///////////////////////////////////////////////////////////////////////////////
+// PLATE MODULES
+///////////////////////////////////////////////////////////////////////////////
+
+module right_half(switch_holes=true, key_size=key_hole_size) {
+ /* Create switch holes or key holes for the right half of the
+ keyboard. Different key_sizes are used in top_plate() and
+ spacer(). */
+ x_offset = 0.5 * row_spacing;
+ y_offset = 0.5 * column_spacing;
+ thumb_key_offset = y_offset + 0.25 * column_spacing;
+ rotate_half() {
+ add_hand_separation() {
+ for (j=[0:(n_thumb_keys-1)]) {
+ switch_hole([x_offset + j*row_spacing, thumb_key_offset]);
+ switch_hole([x_offset + j*row_spacing, thumb_key_offset+2*y_offset]);
+ }
+ for (j=[0:(n_cols-1)]) {
+ column([x_offset + (j+n_thumb_keys)*row_spacing, y_offset + staggering_offsets[j]], switch_holes, key_size);
+ }
+ }
+ }
+}
+
module left_half(switch_holes=true, key_size=key_hole_size) {
- mirror ([1,0,0]) { right_half(switch_holes, key_size); }
+ mirror ([1,0,0]) {
+ right_half(switch_holes, key_size);
+ }
}
module bottom_plate() {
/* bottom layer of the case */
difference() {
- hull() { screw_holes(washer_radius); }
+ hull() {
+ screw_holes(washer_radius);
+ }
screw_holes(screw_hole_radius);
}
}
@@ -258,6 +313,8 @@ module top_plate() {
bottom_plate();
right_half(false);
left_half(false);
+ oled_holes(screw_hole_radius);
+ pointer_holes(screw_hole_radius);
}
}
@@ -267,6 +324,7 @@ module switch_plate() {
bottom_plate();
right_half();
left_half();
+ passthrough();
}
}
@@ -291,34 +349,16 @@ module spacer() {
}
}
-module spacer_quadrant(spacer_quadrant_number) {
- /* Cut a quarter of a spacer. */
- translate([0, spacer_quartering_offset]) {
- intersection() {
- translate([0, -spacer_quartering_offset]) { spacer(); }
- rotate([0, 0, spacer_quadrant_number * 90]) { square([1000, 1000]); }
- }
- }
-}
-
-module quartered_spacer()
-{
- /* Assemble all four quarters of a spacer. */
- spacer_quadrant(0);
- spacer_quadrant(1);
- translate([-5,-10]) spacer_quadrant(2);
- translate([5,-10]) spacer_quadrant(3);
-}
-
/* Create all four layers. */
top_plate();
-translate([300, 0]) { switch_plate(); }
-translate([0, 150]) { bottom_plate(); }
+translate([300, 0]) {
+ switch_plate();
+}
+translate([0, 150]) {
+ bottom_plate();
+}
translate([300, 150]) {
- if (quarter_spacer == true) {
- quartered_spacer();
- }
- else {
- spacer();
- }
+ spacer();
}
+
+///////////////////////////////////////////////////////////////////////////////