-/* 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;
/* 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. */
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`. */
}
}
-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) {
}
}
-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);
}
}
+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,
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);
}
}
bottom_plate();
right_half(false);
left_half(false);
+ oled_holes(screw_hole_radius);
+ pointer_holes(screw_hole_radius);
}
}
bottom_plate();
right_half();
left_half();
+ passthrough();
}
}
}
}
-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();
}
+
+///////////////////////////////////////////////////////////////////////////////