2017-08-13 16:15:42 +00:00
|
|
|
// the point of this file is to be a sort of DSL for constructing keycaps.
|
|
|
|
// when you create a method chain you are just changing the parameters
|
|
|
|
// key.scad uses, it doesn't generate anything itself until the end. This
|
|
|
|
// makes it remain easy to use key.scad like before (except without key profiles)
|
|
|
|
// without having to rely on this file. Unfortunately that means setting tons of
|
2017-09-25 04:04:34 +00:00
|
|
|
// special variables, but that's a limitation of SCAD we have to work around
|
2017-08-13 16:15:42 +00:00
|
|
|
|
2017-08-13 07:04:53 +00:00
|
|
|
/* TODO:
|
2017-09-27 04:16:08 +00:00
|
|
|
* can now measure keycaps very accurately. need to redo measurements: [x] SA [ ] DCS [X] DSA [X] OEM?
|
2017-08-19 16:06:13 +00:00
|
|
|
* make OEM profile from my WASD keyset
|
|
|
|
* Pregenerated keysets for DCS (rounded tops too intense) WITH rounded spacebar [ ] 60% [ ] TKL [ ] full
|
2017-08-16 05:59:19 +00:00
|
|
|
* Add inset stem to all profiles that need it (DCS?)
|
2017-08-19 16:06:13 +00:00
|
|
|
* generate dishes via math? kind of hard
|
2017-08-17 13:57:49 +00:00
|
|
|
* customizer version where everything is copy/pasted in. needs to be last.
|
2017-08-13 07:04:53 +00:00
|
|
|
*/
|
|
|
|
|
2017-08-12 05:10:48 +00:00
|
|
|
use <key.scad>
|
|
|
|
//TODO duplicate def to not make this a special var. maybe not worth it
|
|
|
|
unit = 19.05;
|
|
|
|
|
|
|
|
// defaults
|
|
|
|
$bottom_key_width = 18.16;
|
|
|
|
$bottom_key_height = 18.16;
|
|
|
|
$width_difference = 6;
|
|
|
|
$height_difference = 4;
|
|
|
|
$total_depth = 11.5;
|
|
|
|
$top_tilt = -6;
|
|
|
|
$top_skew = 1.7;
|
2017-09-25 04:04:34 +00:00
|
|
|
$dish_type = "cylindrical";
|
2017-08-12 05:10:48 +00:00
|
|
|
$dish_depth = 1;
|
|
|
|
$dish_skew_x = 0;
|
|
|
|
$dish_skew_y = 0;
|
|
|
|
$key_length = 1;
|
|
|
|
$key_height = 1;
|
|
|
|
$has_brim = false;
|
|
|
|
$inverted_dish = false;
|
|
|
|
$connectors = [[0,0]];
|
|
|
|
$ISOEnter = false;
|
|
|
|
$rounded_key = false;
|
|
|
|
$stem_profile = 0;
|
2017-08-13 07:04:53 +00:00
|
|
|
$stem_inset = 0;
|
|
|
|
$stem_rotation = 0;
|
2017-08-15 02:48:01 +00:00
|
|
|
$text = "";
|
|
|
|
$inset_text = false;
|
|
|
|
$corner_radius = 1;
|
2017-08-15 05:59:12 +00:00
|
|
|
$height_slices = 1;
|
2017-08-12 05:10:48 +00:00
|
|
|
|
|
|
|
// key profile definitions
|
|
|
|
|
|
|
|
module dcs_row(n=1) {
|
|
|
|
// names, so I don't go crazy
|
|
|
|
$bottom_key_width = 18.16;
|
|
|
|
$bottom_key_height = 18.16;
|
|
|
|
$width_difference = 6;
|
|
|
|
$height_difference = 4;
|
2017-09-25 04:04:34 +00:00
|
|
|
$dish_type = "cylindrical";
|
2017-08-12 05:10:48 +00:00
|
|
|
$dish_depth = 1;
|
|
|
|
$dish_skew_x = 0;
|
|
|
|
$dish_skew_y = 0;
|
2017-08-13 07:04:53 +00:00
|
|
|
$top_skew = 1.75;
|
2017-08-12 05:10:48 +00:00
|
|
|
|
|
|
|
if (n == 5) {
|
|
|
|
$total_depth = 11.5;
|
|
|
|
$top_tilt = -6;
|
|
|
|
children();
|
|
|
|
} else if (n == 1) {
|
|
|
|
$total_depth = 8.5;
|
|
|
|
$top_tilt = -1;
|
|
|
|
children();
|
|
|
|
} else if (n == 2) {
|
|
|
|
$total_depth = 7.5;
|
|
|
|
$top_tilt = 3;
|
|
|
|
children();
|
|
|
|
} else if (n == 3) {
|
|
|
|
$total_depth = 6;
|
|
|
|
$top_tilt = 7;
|
|
|
|
children();
|
|
|
|
} else if (n == 4) {
|
|
|
|
$total_depth = 6;
|
|
|
|
$top_tilt = 16;
|
|
|
|
children();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-09-25 04:04:34 +00:00
|
|
|
module oem_row(n=1) {
|
|
|
|
$bottom_key_width = 18.05;
|
|
|
|
$bottom_key_height = 18.05;
|
|
|
|
$width_difference = 5.8;
|
|
|
|
$height_difference = 4;
|
|
|
|
$dish_type = "cylindrical";
|
|
|
|
$dish_depth = 1;
|
|
|
|
$dish_skew_x = 0;
|
|
|
|
$dish_skew_y = 0;
|
|
|
|
$top_skew = 1.75;
|
2017-09-27 04:16:08 +00:00
|
|
|
$stem_inset = 1.2;
|
2017-09-25 04:04:34 +00:00
|
|
|
|
|
|
|
if (n == 5) {
|
|
|
|
$total_depth = 11.2;
|
|
|
|
$top_tilt = -3;
|
|
|
|
children();
|
|
|
|
} else if (n == 1) {
|
|
|
|
$total_depth = 9.45;
|
|
|
|
$top_tilt = 1;
|
|
|
|
children();
|
|
|
|
} else if (n == 2) {
|
|
|
|
$total_depth = 9;
|
|
|
|
$top_tilt = 6;
|
|
|
|
children();
|
|
|
|
} else if (n == 3) {
|
|
|
|
$total_depth = 9.25;
|
|
|
|
$top_tilt = 9;
|
|
|
|
children();
|
|
|
|
} else if (n == 4) {
|
|
|
|
$total_depth = 9.25;
|
|
|
|
$top_tilt = 10;
|
|
|
|
children();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-08-12 05:10:48 +00:00
|
|
|
module dsa_row(n=3) {
|
2017-09-25 04:04:34 +00:00
|
|
|
$bottom_key_width = 18.24; // 18.4;
|
|
|
|
$bottom_key_height = 18.24; // 18.4;
|
|
|
|
$width_difference = 6; // 5.7;
|
|
|
|
$height_difference = 6; // 5.7;
|
2017-09-27 04:16:08 +00:00
|
|
|
$total_depth = 8.1;
|
2017-08-13 07:04:53 +00:00
|
|
|
$top_tilt = (n-1) * 7 - 14;
|
2017-08-12 05:10:48 +00:00
|
|
|
$top_skew = 0;
|
2017-09-25 04:04:34 +00:00
|
|
|
$dish_type = "spherical";
|
2017-08-12 05:10:48 +00:00
|
|
|
$dish_depth = 1.2;
|
|
|
|
$dish_skew_x = 0;
|
|
|
|
$dish_skew_y = 0;
|
2017-08-17 06:09:17 +00:00
|
|
|
$height_slices = 10;
|
|
|
|
$enable_side_sculpting = true;
|
|
|
|
// might wanna change this if you don't minkowski
|
|
|
|
// do you even minkowski bro
|
|
|
|
$corner_radius = 0.25;
|
2017-08-12 05:10:48 +00:00
|
|
|
|
|
|
|
children();
|
|
|
|
}
|
|
|
|
|
|
|
|
module sa_row(n=1) {
|
|
|
|
$bottom_key_width = 18.4;
|
|
|
|
$bottom_key_height = 18.4;
|
|
|
|
$width_difference = 5.7;
|
|
|
|
$height_difference = 5.7;
|
2017-09-25 04:04:34 +00:00
|
|
|
$dish_type = "spherical";
|
2017-08-13 07:04:53 +00:00
|
|
|
$dish_depth = 0.85;
|
2017-08-12 05:10:48 +00:00
|
|
|
$dish_skew_x = 0;
|
|
|
|
$dish_skew_y = 0;
|
2017-08-13 07:04:53 +00:00
|
|
|
$top_skew = 0;
|
2017-08-15 05:59:12 +00:00
|
|
|
$height_slices = 10;
|
2017-08-16 05:59:19 +00:00
|
|
|
$enable_side_sculpting = true;
|
|
|
|
// might wanna change this if you don't minkowski
|
|
|
|
// do you even minkowski bro
|
2017-08-17 06:09:17 +00:00
|
|
|
$corner_radius = 0.25;
|
2017-08-12 05:10:48 +00:00
|
|
|
|
|
|
|
if (n == 1){
|
2017-08-13 07:04:53 +00:00
|
|
|
$total_depth = 14.89;
|
|
|
|
$top_tilt = -13;
|
2017-08-12 05:10:48 +00:00
|
|
|
children();
|
|
|
|
} else if (n == 2) {
|
2017-08-13 07:04:53 +00:00
|
|
|
$total_depth = 12.925;
|
2017-08-12 05:10:48 +00:00
|
|
|
$top_tilt = -7;
|
|
|
|
children();
|
|
|
|
} else if (n == 3) {
|
2017-08-13 07:04:53 +00:00
|
|
|
$total_depth = 12.5;
|
2017-08-12 05:10:48 +00:00
|
|
|
$top_tilt = 0;
|
|
|
|
children();
|
|
|
|
} else if (n == 4){
|
2017-08-13 07:04:53 +00:00
|
|
|
$total_depth = 12.925;
|
2017-08-12 05:10:48 +00:00
|
|
|
$top_tilt = 7;
|
|
|
|
children();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module g20() {
|
|
|
|
$bottom_key_width = 18.16;
|
|
|
|
$bottom_key_height = 18.16;
|
|
|
|
$width_difference = 2;
|
|
|
|
$height_difference = 2;
|
|
|
|
$total_depth = 6;
|
|
|
|
$top_tilt = 2.5;
|
|
|
|
$top_skew = 0.75;
|
2017-09-25 04:04:34 +00:00
|
|
|
$dish_type = "no dish";
|
2017-08-12 05:10:48 +00:00
|
|
|
$dish_depth = 0;
|
|
|
|
$dish_skew_x = 0;
|
|
|
|
$dish_skew_y = 0;
|
2017-08-15 02:48:01 +00:00
|
|
|
$minkowski_radius = 1.75;
|
2017-08-12 05:10:48 +00:00
|
|
|
|
2017-08-17 06:09:17 +00:00
|
|
|
|
|
|
|
children();
|
2017-08-12 05:10:48 +00:00
|
|
|
//also,
|
2017-08-17 06:09:17 +00:00
|
|
|
/*$rounded_key = true;*/
|
2017-08-12 05:10:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
module fake_iso_enter() {
|
2017-08-17 06:09:17 +00:00
|
|
|
$bottom_key_width = 18.16 * 1.9;
|
2017-08-12 05:10:48 +00:00
|
|
|
$bottom_key_height = 18.16 * 2;
|
|
|
|
$width_difference = 4;
|
|
|
|
$height_difference = 4;
|
|
|
|
$total_depth = 7;
|
|
|
|
$top_tilt = 0;
|
|
|
|
$top_skew = 1.75;
|
2017-09-25 04:04:34 +00:00
|
|
|
$dish_type = "cylindrical";
|
2017-08-12 05:10:48 +00:00
|
|
|
$dish_depth = 1;
|
|
|
|
$dish_skew_x = 0;
|
|
|
|
$dish_skew_y = 0;
|
2017-08-16 03:56:27 +00:00
|
|
|
$ISOEnter = true;
|
2017-08-12 05:10:48 +00:00
|
|
|
|
2017-08-16 05:59:19 +00:00
|
|
|
stabilized(vertical=true) {
|
|
|
|
children();
|
|
|
|
}
|
2017-08-12 05:10:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
module brimmed() {
|
2017-08-13 07:04:53 +00:00
|
|
|
$has_brim = true;
|
2017-08-12 05:10:48 +00:00
|
|
|
children();
|
|
|
|
}
|
|
|
|
|
|
|
|
module rounded() {
|
|
|
|
$rounded_key = true;
|
|
|
|
children();
|
|
|
|
}
|
|
|
|
|
|
|
|
module inverted() {
|
|
|
|
$inverted_dish = true;
|
|
|
|
children();
|
|
|
|
}
|
|
|
|
|
2017-08-16 05:59:19 +00:00
|
|
|
module rotated() {
|
|
|
|
$stem_rotation = 90;
|
|
|
|
children();
|
|
|
|
}
|
|
|
|
|
2017-08-13 07:04:53 +00:00
|
|
|
module stabilized(mm=12, vertical = false) {
|
|
|
|
if (vertical) {
|
|
|
|
$connectors = [
|
|
|
|
[0, 0],
|
|
|
|
[0, mm],
|
|
|
|
[0, -mm]
|
|
|
|
];
|
|
|
|
|
|
|
|
children();
|
|
|
|
} else {
|
|
|
|
$connectors = [
|
|
|
|
[0, 0],
|
|
|
|
[mm, 0],
|
|
|
|
[-mm, 0]
|
|
|
|
];
|
|
|
|
|
|
|
|
children();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module dishless() {
|
2017-09-25 04:04:34 +00:00
|
|
|
$dish_type = "no dish";
|
2017-08-13 07:04:53 +00:00
|
|
|
children();
|
|
|
|
}
|
|
|
|
|
2017-09-28 16:39:11 +00:00
|
|
|
module inset(val=1) {
|
|
|
|
$stem_inset = val;
|
|
|
|
children();
|
|
|
|
}
|
|
|
|
|
2017-08-12 05:10:48 +00:00
|
|
|
module spacebar() {
|
|
|
|
$inverted_dish = true;
|
2017-09-25 04:04:34 +00:00
|
|
|
if ($dish_type == "cylindrical") {
|
|
|
|
$dish_type = "sideways cylindrical";
|
|
|
|
6_25u() stabilized(mm=50) children();
|
|
|
|
} else {
|
|
|
|
6_25u() stabilized(mm=50) children();
|
|
|
|
}
|
2017-08-12 05:10:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
module lshift() {
|
2017-08-13 07:04:53 +00:00
|
|
|
2_25u() stabilized() children();
|
2017-08-12 05:10:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
module rshift() {
|
2017-08-13 07:04:53 +00:00
|
|
|
2_75u() stabilized() children();
|
2017-08-12 05:10:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
module backspace() {
|
2017-08-13 07:04:53 +00:00
|
|
|
2u() stabilized() children();
|
2017-08-12 05:10:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
module enter() {
|
2017-08-13 07:04:53 +00:00
|
|
|
2_25u() stabilized() children();
|
2017-08-12 05:10:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
module numpad_enter() {
|
2017-08-13 07:04:53 +00:00
|
|
|
2uh() stabilized(vertical=true) children();
|
|
|
|
}
|
|
|
|
|
|
|
|
module numpad_plus() {
|
|
|
|
numpad_enter() children();
|
2017-08-12 05:10:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
module numpad_0() {
|
2017-08-13 07:04:53 +00:00
|
|
|
backspace() children();
|
2017-08-12 05:10:48 +00:00
|
|
|
}
|
|
|
|
|
2017-08-13 07:04:53 +00:00
|
|
|
module stepped_caps_lock() {
|
|
|
|
u(1.75) {
|
|
|
|
$connectors = [
|
|
|
|
[-5, 0]
|
|
|
|
];
|
2017-08-12 05:10:48 +00:00
|
|
|
children();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-08-13 07:04:53 +00:00
|
|
|
module translate_u(x=0, y=0, z=0){
|
|
|
|
translate([x * unit, y*unit, z*unit]) children();
|
|
|
|
}
|
|
|
|
|
2017-08-12 05:10:48 +00:00
|
|
|
// key width functions
|
|
|
|
|
|
|
|
module u(u=1) {
|
|
|
|
$key_length = u;
|
|
|
|
children();
|
|
|
|
}
|
|
|
|
|
|
|
|
module 1u() {
|
2017-08-13 07:04:53 +00:00
|
|
|
u(1) children();
|
2017-08-12 05:10:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
module 1_25u() {
|
2017-08-13 07:04:53 +00:00
|
|
|
u(1.25) children();
|
2017-08-12 05:10:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
module 1_5u() {
|
2017-08-13 07:04:53 +00:00
|
|
|
u(1.5) children();
|
|
|
|
}
|
|
|
|
|
|
|
|
module 2u() {
|
|
|
|
u(2) children();
|
2017-08-12 05:10:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
module 2_25u() {
|
2017-08-13 07:04:53 +00:00
|
|
|
u(2.25) children();
|
2017-08-12 05:10:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
module 2_75u() {
|
2017-08-13 07:04:53 +00:00
|
|
|
u(2.75) children();
|
2017-08-12 05:10:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
module 6_25u() {
|
2017-08-13 07:04:53 +00:00
|
|
|
u(6.25) children();
|
2017-08-12 05:10:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// key height functions
|
|
|
|
|
|
|
|
module uh(u=1) {
|
|
|
|
$key_height = u;
|
|
|
|
children();
|
|
|
|
}
|
|
|
|
|
|
|
|
module 1uh() {
|
2017-08-13 07:04:53 +00:00
|
|
|
uh(1) children();
|
2017-08-12 05:10:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
module 2uh() {
|
2017-08-13 07:04:53 +00:00
|
|
|
uh(2) children();
|
2017-08-12 05:10:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
module 1_25uh() {
|
2017-08-13 07:04:53 +00:00
|
|
|
uh(1.25) children();
|
2017-08-12 05:10:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
module 1_5uh() {
|
2017-08-13 07:04:53 +00:00
|
|
|
uh(1.5) children();
|
2017-08-12 05:10:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
module 2_25uh() {
|
2017-08-13 07:04:53 +00:00
|
|
|
uh(2.25) children();
|
2017-08-12 05:10:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
module 2_75uh() {
|
2017-08-13 07:04:53 +00:00
|
|
|
uh(2.75) children();
|
2017-08-12 05:10:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
module 6_25uh() {
|
2017-08-13 07:04:53 +00:00
|
|
|
uh(6.25) children();
|
2017-08-12 05:10:48 +00:00
|
|
|
}
|
|
|
|
|
2017-09-25 04:04:34 +00:00
|
|
|
module filled() {
|
|
|
|
$stem_profile = "filled";
|
|
|
|
children();
|
|
|
|
}
|
2017-08-13 07:04:53 +00:00
|
|
|
module blank() {
|
|
|
|
$stem_profile = "blank";
|
|
|
|
children();
|
2017-08-12 05:10:48 +00:00
|
|
|
}
|
|
|
|
|
2017-08-13 07:04:53 +00:00
|
|
|
module cherry() {
|
|
|
|
$stem_profile = "cherry";
|
|
|
|
children();
|
|
|
|
}
|
2017-08-12 05:10:48 +00:00
|
|
|
|
2017-08-13 07:04:53 +00:00
|
|
|
module alps() {
|
|
|
|
$stem_profile = "alps";
|
|
|
|
children();
|
2017-08-12 05:10:48 +00:00
|
|
|
}
|
|
|
|
|
2017-08-13 07:04:53 +00:00
|
|
|
module rounded_cherry() {
|
|
|
|
$stem_profile = "cherry_rounded";
|
|
|
|
children();
|
|
|
|
}
|
2017-08-12 05:10:48 +00:00
|
|
|
|
2017-08-13 07:04:53 +00:00
|
|
|
module legend(text, inset=false) {
|
|
|
|
$text=text;
|
|
|
|
$inset_text = inset;
|
2017-09-25 04:04:34 +00:00
|
|
|
children();
|
2017-08-12 05:10:48 +00:00
|
|
|
}
|
|
|
|
|
2017-09-25 04:04:34 +00:00
|
|
|
rows = [4,3,2,1,5];
|
2017-08-17 06:09:17 +00:00
|
|
|
|
|
|
|
|
2017-09-27 04:16:08 +00:00
|
|
|
translate_u(0, 0) oem_row(rows[0]) cherry() key();
|
|
|
|
translate_u(0, 1) oem_row(rows[1]) cherry() key();
|