Skip to content

Commit ec44ef7

Browse files
authored
Merge pull request #155 from rsheldiii/typewriter-style
Typewriter style keys
2 parents 2b8a238 + 19de89d commit ec44ef7

File tree

4 files changed

+126
-1
lines changed

4 files changed

+126
-1
lines changed

customizer.scad

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -900,7 +900,66 @@ module dss_row(n=3, column=0) {
900900
children();
901901
}
902902
}
903+
// a safe theoretical distance between two vertices such that they don't collapse. hard to use
904+
SMALLEST_POSSIBLE = 1/128;
905+
$fs=0.1;
906+
$unit=19.05;
907+
// Regular polygon shapes CIRCUMSCRIBE the sphere of diameter $bottom_key_width
908+
// This is to make tiling them easier, like in the case of hexagonal keycaps etc
903909

910+
// this function doesn't set the key shape, so you can't use it directly without some fiddling
911+
module typewriter_row(n=3, column=0) {
912+
$bottom_key_width = $unit - 0.5;
913+
$bottom_key_height = $unit - 0.5;
914+
$width_difference = 0;
915+
$height_difference = 0;
916+
$dish_type = "spherical";
917+
$key_shape_type = "circular";
918+
$inverted_dish = true;
919+
$stem_inset = -4.5;
920+
$stem_throw = 5;
921+
$dish_depth = 1;
922+
$dish_skew_x = 0;
923+
$dish_skew_y = 0;
924+
$top_skew = 0;
925+
$height_slices = 1;
926+
$stem_support_type = "disable";
927+
// $corner_radius = 1;
928+
929+
// this is _incredibly_ intensive
930+
/* $rounded_key = true; */
931+
932+
$top_tilt_y = side_tilt(column);
933+
extra_height = $double_sculpted ? extra_side_tilt_height(column) : 0;
934+
935+
base_depth = 3.5;
936+
if (n <= 1){
937+
$total_depth = base_depth + 2.5 + extra_height;
938+
$top_tilt = -13;
939+
940+
children();
941+
} else if (n == 2) {
942+
$total_depth = base_depth + 0.5 + extra_height;
943+
$top_tilt = -7;
944+
945+
children();
946+
} else if (n == 3) {
947+
$total_depth = base_depth + extra_height;
948+
$top_tilt = 0;
949+
950+
children();
951+
} else if (n == 4){
952+
$total_depth = base_depth + 0.5 + extra_height;
953+
$top_tilt = 7;
954+
955+
children();
956+
} else {
957+
$total_depth = base_depth + extra_height;
958+
$top_tilt = 0;
959+
960+
children();
961+
}
962+
}
904963
// man, wouldn't it be so cool if functions were first order
905964
module key_profile(key_profile_type, row, column=0) {
906965
if (key_profile_type == "dcs") {
@@ -921,6 +980,8 @@ module key_profile(key_profile_type, row, column=0) {
921980
hipro_row(row, column) children();
922981
} else if (key_profile_type == "grid") {
923982
grid_row(row, column) children();
983+
} else if (key_profile_type == "typewriter") {
984+
typewriter_row(row, column) children();
924985
} else if (key_profile_type == "hexagon") {
925986
hexagonal_row(row, column) children();
926987
} else if (key_profile_type == "octagon") {
@@ -3296,6 +3357,8 @@ module key_shape(size, delta, progress = 0) {
32963357
regular_polygon_shape(size, delta, progress);
32973358
} else if ($key_shape_type == "octagon") {
32983359
regular_polygon_shape(size, delta, progress, sides=8);
3360+
} else if ($key_shape_type == "circular") {
3361+
regular_polygon_shape(size, delta, progress, sides=36);
32993362
} else {
33003363
echo("Warning: unsupported $key_shape_type");
33013364
}
@@ -4877,7 +4940,7 @@ module keytext(text, position, font_size, depth) {
48774940
woffset = (top_total_key_width()/3.5) * position[0];
48784941
hoffset = (top_total_key_height()/3.5) * -position[1];
48794942
translate([woffset, hoffset, -depth]){
4880-
color($tertiary_color) linear_extrude(height=2){
4943+
color($tertiary_color) linear_extrude(height=$dish_depth + depth){
48814944
text(text=text, font=$font, size=font_size, halign="center", valign="center");
48824945
}
48834946
}

src/key_profiles.scad

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ include <key_profiles/regular_polygon.scad>
1414
include <key_profiles/cherry.scad>
1515
include <key_profiles/dss.scad>
1616
include <key_profiles/asa.scad>
17+
include <key_profiles/typewriter.scad>
1718

1819
// man, wouldn't it be so cool if functions were first order
1920
module key_profile(key_profile_type, row, column=0) {
@@ -35,6 +36,8 @@ module key_profile(key_profile_type, row, column=0) {
3536
hipro_row(row, column) children();
3637
} else if (key_profile_type == "grid") {
3738
grid_row(row, column) children();
39+
} else if (key_profile_type == "typewriter") {
40+
typewriter_row(row, column) children();
3841
} else if (key_profile_type == "hexagon") {
3942
hexagonal_row(row, column) children();
4043
} else if (key_profile_type == "octagon") {

src/key_profiles/typewriter.scad

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
include <../constants.scad>
2+
// Regular polygon shapes CIRCUMSCRIBE the sphere of diameter $bottom_key_width
3+
// This is to make tiling them easier, like in the case of hexagonal keycaps etc
4+
5+
// this function doesn't set the key shape, so you can't use it directly without some fiddling
6+
module typewriter_row(n=3, column=0) {
7+
$bottom_key_width = $unit - 0.5;
8+
$bottom_key_height = $unit - 0.5;
9+
$width_difference = 0;
10+
$height_difference = 0;
11+
$dish_type = "spherical";
12+
$key_shape_type = "circular";
13+
$inverted_dish = true;
14+
$stem_inset = -4.5;
15+
$stem_throw = 5;
16+
$dish_depth = 1;
17+
$dish_skew_x = 0;
18+
$dish_skew_y = 0;
19+
$top_skew = 0;
20+
$height_slices = 1;
21+
$stem_support_type = "disable";
22+
// $corner_radius = 1;
23+
24+
// this is _incredibly_ intensive
25+
/* $rounded_key = true; */
26+
27+
$top_tilt_y = side_tilt(column);
28+
extra_height = $double_sculpted ? extra_side_tilt_height(column) : 0;
29+
30+
base_depth = 3.5;
31+
if (n <= 1){
32+
$total_depth = base_depth + 2.5 + extra_height;
33+
$top_tilt = -13;
34+
35+
children();
36+
} else if (n == 2) {
37+
$total_depth = base_depth + 0.5 + extra_height;
38+
$top_tilt = -7;
39+
40+
children();
41+
} else if (n == 3) {
42+
$total_depth = base_depth + extra_height;
43+
$top_tilt = 0;
44+
45+
children();
46+
} else if (n == 4){
47+
$total_depth = base_depth + 0.5 + extra_height;
48+
$top_tilt = 7;
49+
50+
children();
51+
} else {
52+
$total_depth = base_depth + extra_height;
53+
$top_tilt = 0;
54+
55+
children();
56+
}
57+
}

src/shapes.scad

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ module key_shape(size, delta, progress = 0) {
2828
regular_polygon_shape(size, delta, progress);
2929
} else if ($key_shape_type == "octagon") {
3030
regular_polygon_shape(size, delta, progress, sides=8);
31+
} else if ($key_shape_type == "circular") {
32+
regular_polygon_shape(size, delta, progress, sides=36);
3133
} else {
3234
echo("Warning: unsupported $key_shape_type");
3335
}

0 commit comments

Comments
 (0)