From c11e8a653dbeb34ce93db1df14b07e5ea42c38a6 Mon Sep 17 00:00:00 2001 From: Bob Date: Sat, 11 Jan 2020 22:59:30 -0500 Subject: [PATCH 1/7] flat dish not super useful tbh, but I was testing linear extruded keycaps and I needed them to be cut off correctly --- src/dishes.scad | 3 +++ src/dishes/flat.scad | 3 +++ 2 files changed, 6 insertions(+) create mode 100644 src/dishes/flat.scad diff --git a/src/dishes.scad b/src/dishes.scad index 121dc8b..2302882 100644 --- a/src/dishes.scad +++ b/src/dishes.scad @@ -4,6 +4,7 @@ include include include include +include //geodesic looks much better, but runs very slow for anything above a 2u geodesic=false; @@ -21,6 +22,8 @@ module dish(width, height, depth, inverted) { } else if ($dish_type == "old spherical") { old_spherical_dish(width, height, depth, inverted); + } else if ($dish_type == "flat") { + flat_dish(width, height, depth, inverted); } else if ($dish_type == "disable") { // else no dish } else { diff --git a/src/dishes/flat.scad b/src/dishes/flat.scad new file mode 100644 index 0000000..b5bba6a --- /dev/null +++ b/src/dishes/flat.scad @@ -0,0 +1,3 @@ +module flat_dish(width, height, depth, inverted){ + cube([width + 100,height + 100, depth], center=true); +} From 925c6c4819ed6b4fd860d6728f8bbc9c61084352 Mon Sep 17 00:00:00 2001 From: Bob Date: Sat, 11 Jan 2020 23:00:54 -0500 Subject: [PATCH 2/7] fix dsa full sculpt --- src/key_profiles/dsa.scad | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/key_profiles/dsa.scad b/src/key_profiles/dsa.scad index 3748914..fee6b09 100644 --- a/src/key_profiles/dsa.scad +++ b/src/key_profiles/dsa.scad @@ -14,23 +14,24 @@ module dsa_row(row=3, column = 0) { $enable_side_sculpting = true; $corner_radius = 0.25; - $top_tilt_y = column * 3 * $double_sculpt_modifier; + $top_tilt_y = side_tilt(column); + extra_height = extra_side_tilt_height(column); depth_raisers = [0, 3.5, 1, 0, 1, 3]; - if (row == 5) { - $total_depth = 8.1 + depth_raisers[row]; + if (row < 1 || row > 4) { + $total_depth = 8.1 + depth_raisers[row] + extra_height; children(); } else if (row == 1) { - $total_depth = 8.1 + depth_raisers[row]; + $total_depth = 8.1 + depth_raisers[row] + extra_height; children(); } else if (row == 2) { - $total_depth = 8.1 + depth_raisers[row]; + $total_depth = 8.1 + depth_raisers[row] + extra_height; children(); } else if (row == 3) { - $total_depth = 8.1 + depth_raisers[row]; + $total_depth = 8.1 + depth_raisers[row] + extra_height; children(); } else if (row == 4) { - $total_depth = 8.1 + depth_raisers[row]; + $total_depth = 8.1 + depth_raisers[row] + extra_height; children(); } else { children(); From c06b54820182f58b8934b1ae3320b5a7be15471e Mon Sep 17 00:00:00 2001 From: Bob Date: Sat, 11 Jan 2020 23:02:43 -0500 Subject: [PATCH 3/7] no stem support --- src/key_transformations.scad | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/key_transformations.scad b/src/key_transformations.scad index 10ab530..e2da732 100644 --- a/src/key_transformations.scad +++ b/src/key_transformations.scad @@ -7,6 +7,11 @@ module translate_u(x=0, y=0, z=0){ translate([x * unit, y*unit, z*unit]) children(); } +module no_stem_support() { + $stem_support_type = "disable"; + children(); +} + module brimmed_stem_support(height = 0.4) { $stem_support_type = "brim"; $stem_support_height = height; From cb7a3010523c92fb0a9613d857147cf8cc25e85e Mon Sep 17 00:00:00 2001 From: Bob Date: Sat, 11 Jan 2020 23:29:40 -0500 Subject: [PATCH 4/7] fix upside_down rotate 180 degrees so the labels are correct --- src/key_transformations.scad | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/key_transformations.scad b/src/key_transformations.scad index e2da732..b03184a 100644 --- a/src/key_transformations.scad +++ b/src/key_transformations.scad @@ -141,7 +141,8 @@ module bump(depth=undef) { // might not work great with fully sculpted profiles yet module upside_down() { // $top_tilt*2 because top_placement rotates by top_tilt for us - top_placement() rotate([180+$top_tilt*2,0,0]) { + // first rotate 180 to get the keycaps to face the same direction + rotate([0,0,180]) top_placement() rotate([180+$top_tilt*2,0,0]) { children(); } } From 425ae8af346e1be67db2d09509d45ab5b84ba7e0 Mon Sep 17 00:00:00 2001 From: Bob Date: Sat, 11 Jan 2020 23:31:01 -0500 Subject: [PATCH 5/7] Layout allows children now you can do stuff like: ``` gherkin_bump_layout("g20") { upside_down() key(); }; ``` and it'll work! you still have to specify the profile in the layout itself because row and column are not special variables... hm --- src/layouts/gherkin/gherkin_bump.scad | 4 ++- src/layouts/layout.scad | 42 +++++++++++++++++++++++---- 2 files changed, 39 insertions(+), 7 deletions(-) diff --git a/src/layouts/gherkin/gherkin_bump.scad b/src/layouts/gherkin/gherkin_bump.scad index b82c435..779cc64 100644 --- a/src/layouts/gherkin/gherkin_bump.scad +++ b/src/layouts/gherkin/gherkin_bump.scad @@ -16,5 +16,7 @@ gherkin_bump_legends = [ ]; module gherkin_bump_layout(profile, row_sculpting_offset=1, column_override=undef) { - layout(gherkin_bump_mapping, profile, legends=gherkin_bump_legends, row_sculpting_offset=row_sculpting_offset, column_override=column_override, column_sculpt_profile="cresting_wave"); + layout(gherkin_bump_mapping, profile, legends=gherkin_bump_legends, row_sculpting_offset=row_sculpting_offset, column_override=column_override, column_sculpt_profile="cresting_wave") { + children(); + }; } diff --git a/src/layouts/layout.scad b/src/layouts/layout.scad index 7c58cd7..b5ba3f6 100644 --- a/src/layouts/layout.scad +++ b/src/layouts/layout.scad @@ -6,7 +6,7 @@ function abs_sum(list, x=0) = abs_sum([for (x = [1: len(list) - 1]) list[x]], x+abs(list[0])); function 2hands(index, total) = ((index+0.5) % (total/2)) - (total/4); -function cresting_wave(index, total, mod=5) = (index < total/2) ? (((index + 0.5) / total)*mod) : -(mod - ((index + 0.5) / total * mod)); +function cresting_wave(index, total, mod=4) = (index < total/2) ? (((index + 0.5) / total)*mod) : -(mod - ((index + 0.5) / total * mod)); function 1hand(index, total) = (index % (total)) - (total/2); @@ -38,15 +38,45 @@ module layout(list, profile="dcs", legends=undef, row_sculpting_offset=0, row_ov translate_u(column_distance - (key_length/2), -row) { key_profile(profile, row_sculpting, column_value) u(key_length) legend(legends ? legends[row][column] : "") cherry() { // (row+4) % 5 + 1 if (key_length == 6.25) { - spacebar() key(); + spacebar() { + if ($children) { + children(); + } else { + key(); + } + } } else if (key_length == 2.25) { - lshift() key(); + lshift() { + if ($children) { + children(); + } else { + key(); + } + } } else if (key_length == 2) { - backspace() key(); + backspace() { + if ($children) { + children(); + } else { + key(); + } + } } else if (key_length == 2.75) { - rshift() key(); + rshift() { + if ($children) { + children(); + } else { + key(); + } + } } else { - key(); + { + if ($children) { + children(); + } else { + key(); + } + } } } } From f6762031dbc15fd891b905f311d053436165d1df Mon Sep 17 00:00:00 2001 From: Bob Date: Sat, 11 Jan 2020 23:32:14 -0500 Subject: [PATCH 6/7] front placement now you can put labels on the front of keycaps! --- src/key.scad | 39 ++++++++++++++++++++++++++++++++++----- src/settings.scad | 2 +- 2 files changed, 35 insertions(+), 6 deletions(-) diff --git a/src/key.scad b/src/key.scad index ed2eaf2..bedd248 100644 --- a/src/key.scad +++ b/src/key.scad @@ -192,6 +192,25 @@ module top_placement(depth_difference=0) { } } +module front_placement() { + // all this math is to take top skew and tilt into account + // we need to find the new effective height and depth of the top, front lip + // of the keycap to find the angle so we can rotate things correctly into place + total_depth_difference = sin(-$top_tilt) * (top_total_key_height()/2); + total_height_difference = $top_skew + (1 - cos(-$top_tilt)) * (top_total_key_height()/2); + + angle = atan2(($total_depth - total_depth_difference), ($height_difference/2 + total_height_difference)); + hypotenuse = ($total_depth -total_depth_difference) / sin(angle); + + translate([0,-total_key_height()/2,0]) { + rotate([-(90-angle), 0, 0]) { + translate([0,0,hypotenuse/2]){ + children(); + } + } + } +} + // just to DRY up the code module _dish() { dish(top_total_key_width() + $dish_overdraw_width, top_total_key_height() + $dish_overdraw_height, $dish_depth, $inverted_dish); @@ -309,11 +328,21 @@ module clearance_check() { } module legends(depth) { - top_of_key() { - // outset legend - if (len($legends) > 0) { - for (i=[0:len($legends)-1]) { - keytext($legends[i][0], $legends[i][1], $legends[i][2], depth); + if ($front_print_legends) { + front_placement() { + if (len($legends) > 0) { + for (i=[0:len($legends)-1]) { + rotate([90,0,0]) keytext($legends[i][0], $legends[i][1], $legends[i][2], depth); + } + } + } + } else { + top_of_key() { + // outset legend + if (len($legends) > 0) { + for (i=[0:len($legends)-1]) { + keytext($legends[i][0], $legends[i][1], $legends[i][2], depth); + } } } } diff --git a/src/settings.scad b/src/settings.scad index 6858f17..c48a3fc 100644 --- a/src/settings.scad +++ b/src/settings.scad @@ -151,7 +151,7 @@ $legends = []; $outset_legends = false; // how recessed inset legends / artisans are from the top of the key -$inset_legend_depth = 0.3; +$inset_legend_depth = 0.2; // Dimensions of alps stem $alps_stem = [4.45, 2.25]; From 48377ee7490982af62804d8f42dd2efba82be1e9 Mon Sep 17 00:00:00 2001 From: Bob Date: Sat, 11 Jan 2020 23:34:29 -0500 Subject: [PATCH 7/7] Update settings.scad --- src/settings.scad | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/settings.scad b/src/settings.scad index c48a3fc..08af884 100644 --- a/src/settings.scad +++ b/src/settings.scad @@ -150,6 +150,9 @@ $legends = []; // broken off from artisan support since who wants outset legends? $outset_legends = false; +// print legends on the front of the key instead of the top +$front_print_legends = false; + // how recessed inset legends / artisans are from the top of the key $inset_legend_depth = 0.2;