From 13520c54e3dddaea51db04041146ce510fc3ddad Mon Sep 17 00:00:00 2001 From: mebers200 Date: Thu, 8 Jul 2021 20:30:12 -0600 Subject: [PATCH 01/10] Adding new dishes, a profile clone of MT3 (Matty3), and a second HiPro clone with more accurate dishes. --- src/dishes.scad | 12 ++++-- src/dishes/squared_scoop.scad | 71 +++++++++++++++++++++++++++++++ src/dishes/squared_spherical.scad | 14 ++++++ src/key_profiles.scad | 6 +++ src/key_profiles/hipro2.scad | 43 +++++++++++++++++++ src/key_profiles/matty3.scad | 52 ++++++++++++++++++++++ 6 files changed, 194 insertions(+), 4 deletions(-) create mode 100644 src/dishes/squared_scoop.scad create mode 100644 src/dishes/squared_spherical.scad create mode 100644 src/key_profiles/hipro2.scad create mode 100644 src/key_profiles/matty3.scad diff --git a/src/dishes.scad b/src/dishes.scad index a8bfba7..32f5519 100644 --- a/src/dishes.scad +++ b/src/dishes.scad @@ -4,6 +4,8 @@ include include include include +include +include include include @@ -14,11 +16,9 @@ geodesic=false; module dish(width, height, depth, inverted) { if($dish_type == "cylindrical"){ cylindrical_dish(width, height, depth, inverted); - } - else if ($dish_type == "spherical") { + } else if ($dish_type == "spherical") { spherical_dish(width, height, depth, inverted); - } - else if ($dish_type == "sideways cylindrical"){ + } else if ($dish_type == "sideways cylindrical"){ sideways_cylindrical_dish(width, height, depth, inverted); } else if ($dish_type == "old spherical") { old_spherical_dish(width, height, depth, inverted); @@ -28,6 +28,10 @@ module dish(width, height, depth, inverted) { flat_dish(width, height, depth, inverted); } else if ($dish_type == "disable") { // else no dish + } else if ($dish_type == "squared spherical") { + squared_spherical_dish(width, height, depth, inverted=inverted); + } else if ($dish_type == "squared scoop") { + squared_scoop_dish(width, height, depth, inverted=inverted); } else { echo("WARN: $dish_type unsupported"); } diff --git a/src/dishes/squared_scoop.scad b/src/dishes/squared_scoop.scad new file mode 100644 index 0000000..5031c57 --- /dev/null +++ b/src/dishes/squared_scoop.scad @@ -0,0 +1,71 @@ +module squared_scoop_dish(height, width, depth, r=0.5, inverted=false, num=3, den=4){ + // changable numerator/denoninator on where to place the square's corners + // for example, num=2, den=3 means the dish will happen at 1/3 and 2/3 the + // width and the height. Defaults to 3/4s. Customizable when calling + // this module + // + // This was initially intended for the scoop on the HiPro, since that's what + // it uses. Use "hipro2_row()" if that's what you'd like. However, I do NOT + // know how close the inner square is for the HiPro keycaps. In fact, it could + // just be a sphere, in which the "squared spherical" scoop is more appropriate. + // If, however, it the "squared scoop" makes sense, you can adjust where the square + // lands with the num (numerator) and den (denominator) variables. For instance, + // "3" and "4" mean 3/4 of the width/height is where the flat part starts. + + chord = pow(pow(height/2, 2) + pow(width/2, 2),0.5); + direction = inverted ? -1 : 1; + + //This is the set of points to hull around for the scoop + points=[ + [height/den,width/den, -chord], + [num*height/den,width/den,-chord], + [height/den,num*width/den, -chord], + [num*height/den,num*width/den,-chord] + ]; + + translate([-(width + r) / 2, -(height + r) / 2, 0 * direction]) + resize([height+r,width+r,depth]) + hull() { + cube([height,width,0.001],center=false); + for(i=[0:len(points)-1]) { + translate(points[i]) + sphere(r=r,$fn=64); + } + } +} + +/* ************************** * + * ORIGINAL ATTEMPT * + * DO NOT USE * + * KEPT FOR NOW IF I'M * + * MISSING SOMETHING * + * ************************** */ + +// module squared_scoop_dish(height, width, depth, r=0.5, inverted=false, num=3, den=4){ +// // changable numerator/denoninator on where to place the square's corners +// // for example, num=2, den=3 means the dish will happen at 1/3 and 2/3 the +// // width and the height. Defaults to 3/4s. Customizable when calling +// // this module + +// chord = pow(pow(height/2, 2) + pow(width/2, 2),0.5); +// direction = inverted ? -1 : 1; + +// //This is the set of points to hull around for the scoop +// points=[ +// [height/den,width/den, -chord], +// [num*height/den,width/den,-chord], +// [height/den,num*width/den, -chord], +// [num*height/den,num*width/den,-chord], +// [height/2, width/2, -chord - 1] +// ]; + +// translate([-width / 2, -height / 2, 0 * direction]) +// resize([height,width,depth]) +// hull() { +// cube([height,width,0.001],center=false); +// for(i=[0:len(points)-1]) { +// translate(points[i]) +// sphere(r=r,$fn=64); +// } +// } +// } diff --git a/src/dishes/squared_spherical.scad b/src/dishes/squared_spherical.scad new file mode 100644 index 0000000..fed06a7 --- /dev/null +++ b/src/dishes/squared_spherical.scad @@ -0,0 +1,14 @@ +module squared_spherical_dish(width, height, depth, inverted=false) { + chord = pow(pow(height / 2, 2) + pow(width / 2, 2),0.5); + direction = inverted ? -1 : 1; + r=width / 3.5; + + translate([-width / 2, -height / 2, 0 * direction]) { + resize([width, height, depth]) + hull() { + cube([width,height,0.001]); + translate([width/2, height/2, -chord]) + sphere(r=r, $fn=64); + } + } +} \ No newline at end of file diff --git a/src/key_profiles.scad b/src/key_profiles.scad index 8aa2a62..759260a 100644 --- a/src/key_profiles.scad +++ b/src/key_profiles.scad @@ -8,6 +8,8 @@ include include include include +include +include include include include @@ -32,6 +34,10 @@ module key_profile(key_profile_type, row, column=0) { grid_row(row, column) children(); } else if (key_profile_type == "cherry") { cherry_row(row, column) children(); + } else if (key_profile_type == "hipro2") { + hipro2_row(row, column) children(); + } else if (key_profile_type == "matty3") { + matty3_row(row, column) children(); } else if (key_profile_type == "disable") { children(); } else { diff --git a/src/key_profiles/hipro2.scad b/src/key_profiles/hipro2.scad new file mode 100644 index 0000000..bcf75c5 --- /dev/null +++ b/src/key_profiles/hipro2.scad @@ -0,0 +1,43 @@ +// Takes rsheldiii's hipro profile and adds the "squared scoop" +// dish that appears to be what true HiPros are using up top +// Not perfect as it slightly clips the corners of keys +module hipro2_row(row=3, column=0) { + $key_shape_type = "sculpted_square"; + + $bottom_key_width = 18.35; + $bottom_key_height = 18.17; + + $width_difference = ($bottom_key_width - 12.3); + $height_difference = ($bottom_key_height - 12.65); + $dish_type = "squared scoop"; + $dish_depth = 0.75; + $dish_skew_x = 0; + $dish_skew_y = 0; + $top_skew = 0; + $height_slices = 10; + $corner_radius = 1; + + $top_tilt_y = side_tilt(column); + extra_height = $double_sculpted ? extra_side_tilt_height(column) : 0; + + if (row <= 1){ + $total_depth = 13.7 + extra_height; + // TODO I didn't change these yet + $top_tilt = -13; + children(); + } else if (row == 2) { + $total_depth = 11.1 + extra_height; + $top_tilt = -7; + children(); + } else if (row == 3) { + $total_depth = 11.1 + extra_height; + $top_tilt = 7; + children(); + } else if (row == 4 || row == 5){ + $total_depth = 12.25 + extra_height; + $top_tilt = 13; + children(); + } else { + children(); + } +} diff --git a/src/key_profiles/matty3.scad b/src/key_profiles/matty3.scad new file mode 100644 index 0000000..88232c0 --- /dev/null +++ b/src/key_profiles/matty3.scad @@ -0,0 +1,52 @@ +// This is an imperfect attempt to clone the MT3 profile +// I'm unsure if "MT3" is copyrighted or anything, but +// Since my name is "Matt" and "Matty3" sounds like "MT3," +// that's what I'm going with for now +module matty3_row(row=3, column=0) { + $key_shape_type = "sculpted_square"; + + $bottom_key_width = 18.35; + $bottom_key_height = 18.6; + + $width_difference = ($bottom_key_width - 13.0); + $height_difference = ($bottom_key_height - 13.0); + $dish_type = "squared spherical"; + $dish_depth = 0.75; + $dish_skew_x = 0; + $dish_skew_y = 0; + $top_skew = 0; + $height_slices = 10; + $corner_radius = 1; + + $top_tilt_y = side_tilt(column); + extra_height = $double_sculpted ? extra_side_tilt_height(column) : 0; + + if (row == 0){ + // TODO I didn't change these yet + $total_depth = 14.6 + extra_height; + $top_tilt = -12; + children(); + } else if (row == 1) { + $total_depth = 13.1 + extra_height; + $top_tilt = -6; + children(); + } else if (row == 2) { + $total_depth = 10.7 + extra_height; + $top_tilt = -6; + children(); + } else if (row == 3) { + $total_depth = 10.7 + extra_height; + $top_tilt = 6; + children(); + } else if (row == 4){ + $total_depth = 11.6 + extra_height; + $top_tilt = 12; + children(); + } else if (row >= 5) { + $total_depth = 11.6 + extra_height; + $top_tilt = 0; + children(); + } else { + children(); + } +} From d3c26dfacad9bb6fede50df81707f5b53c1652db Mon Sep 17 00:00:00 2001 From: mebers200 Date: Fri, 9 Jul 2021 10:22:03 -0600 Subject: [PATCH 02/10] fixing squared_spherical dish to work with all sizes --- src/dishes/squared_spherical.scad | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/dishes/squared_spherical.scad b/src/dishes/squared_spherical.scad index fed06a7..30859b1 100644 --- a/src/dishes/squared_spherical.scad +++ b/src/dishes/squared_spherical.scad @@ -1,13 +1,21 @@ module squared_spherical_dish(width, height, depth, inverted=false) { chord = pow(pow(height / 2, 2) + pow(width / 2, 2),0.5); direction = inverted ? -1 : 1; - r=width / 3.5; + r=max(height,width,chord) / 5; + // ^^^^^ Nothing special about this code to figure out r. + // I just modeled up 1u, 1.25u, 1.5u, 2u, 2.25u, and 2.75u + // keys and messed around until I came up with something that + // looked reasonable for all key sizes. This just seems to work + // well for all sizes translate([-width / 2, -height / 2, 0 * direction]) { resize([width, height, depth]) hull() { - cube([width,height,0.001]); - translate([width/2, height/2, -chord]) + cube([chord,chord,0.001]); + // Use something larger in this translate than -depth + // (like -chord) if you want more of a defined circle + // in the keywell + translate([chord/2, chord/2, -depth]) sphere(r=r, $fn=64); } } From 29f5cd246891fd8cc7ead134debf82712f9031a4 Mon Sep 17 00:00:00 2001 From: mebers200 Date: Fri, 9 Jul 2021 10:41:34 -0600 Subject: [PATCH 03/10] Fixing squared_scoop dish to work with keycaps other than 1u sizing --- src/dishes/squared_scoop.scad | 65 ++++++++--------------------------- 1 file changed, 14 insertions(+), 51 deletions(-) diff --git a/src/dishes/squared_scoop.scad b/src/dishes/squared_scoop.scad index 5031c57..9a8f74c 100644 --- a/src/dishes/squared_scoop.scad +++ b/src/dishes/squared_scoop.scad @@ -1,7 +1,7 @@ -module squared_scoop_dish(height, width, depth, r=0.5, inverted=false, num=3, den=4){ +module squared_scoop_dish(height, width, depth, r=0.5, inverted=false, num=4, den=5){ // changable numerator/denoninator on where to place the square's corners // for example, num=2, den=3 means the dish will happen at 1/3 and 2/3 the - // width and the height. Defaults to 3/4s. Customizable when calling + // width and the height. Defaults to 4/5. Customizable when calling // this module // // This was initially intended for the scoop on the HiPro, since that's what @@ -17,55 +17,18 @@ module squared_scoop_dish(height, width, depth, r=0.5, inverted=false, num=3, de //This is the set of points to hull around for the scoop points=[ - [height/den,width/den, -chord], - [num*height/den,width/den,-chord], - [height/den,num*width/den, -chord], - [num*height/den,num*width/den,-chord] + [height/den - height/2,width/den - width/2, -chord], + [num*height/den - height/2,width/den - width/2,-chord], + [height/den - height/2,num*width/den - width/2, -chord], + [num*height/den - height/2,num*width/den - width/2,-chord] ]; - translate([-(width + r) / 2, -(height + r) / 2, 0 * direction]) - resize([height+r,width+r,depth]) - hull() { - cube([height,width,0.001],center=false); - for(i=[0:len(points)-1]) { - translate(points[i]) - sphere(r=r,$fn=64); - } - } + resize([height,width,depth]) + hull() { + cube([height,width,0.001],center=true); + for(i=[0:len(points)-1]) { + translate(points[i]) + sphere(r=r,$fn=64); + } + } } - -/* ************************** * - * ORIGINAL ATTEMPT * - * DO NOT USE * - * KEPT FOR NOW IF I'M * - * MISSING SOMETHING * - * ************************** */ - -// module squared_scoop_dish(height, width, depth, r=0.5, inverted=false, num=3, den=4){ -// // changable numerator/denoninator on where to place the square's corners -// // for example, num=2, den=3 means the dish will happen at 1/3 and 2/3 the -// // width and the height. Defaults to 3/4s. Customizable when calling -// // this module - -// chord = pow(pow(height/2, 2) + pow(width/2, 2),0.5); -// direction = inverted ? -1 : 1; - -// //This is the set of points to hull around for the scoop -// points=[ -// [height/den,width/den, -chord], -// [num*height/den,width/den,-chord], -// [height/den,num*width/den, -chord], -// [num*height/den,num*width/den,-chord], -// [height/2, width/2, -chord - 1] -// ]; - -// translate([-width / 2, -height / 2, 0 * direction]) -// resize([height,width,depth]) -// hull() { -// cube([height,width,0.001],center=false); -// for(i=[0:len(points)-1]) { -// translate(points[i]) -// sphere(r=r,$fn=64); -// } -// } -// } From e7b92cf52b40f718326ab8795833594f1e3f547e Mon Sep 17 00:00:00 2001 From: Matthew Ebersviller Date: Fri, 9 Jul 2021 10:57:06 -0600 Subject: [PATCH 04/10] Update squared_scoop.scad Fixed some formatting to be easier to read --- src/dishes/squared_scoop.scad | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/dishes/squared_scoop.scad b/src/dishes/squared_scoop.scad index 9a8f74c..366f2a9 100644 --- a/src/dishes/squared_scoop.scad +++ b/src/dishes/squared_scoop.scad @@ -17,10 +17,10 @@ module squared_scoop_dish(height, width, depth, r=0.5, inverted=false, num=4, de //This is the set of points to hull around for the scoop points=[ - [height/den - height/2,width/den - width/2, -chord], - [num*height/den - height/2,width/den - width/2,-chord], - [height/den - height/2,num*width/den - width/2, -chord], - [num*height/den - height/2,num*width/den - width/2,-chord] + [height/den - height/2, width/den - width/2, -chord], + [num*height/den - height/2, width/den - width/2, -chord], + [height/den - height/2, num*width/den - width/2, -chord], + [num*height/den - height/2, num*width/den - width/2, -chord] ]; resize([height,width,depth]) From cdf75654a681f7147e98355ddb0f0fd713eabe6c Mon Sep 17 00:00:00 2001 From: Matthew Ebersviller Date: Fri, 9 Jul 2021 12:14:10 -0600 Subject: [PATCH 05/10] fixing 60 percent layout 60 percent layout needed array of [0] for row 0 (Function keys). Without it, every row was getting the wrong depth/angle. --- src/layouts/60_percent/default.scad | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/layouts/60_percent/default.scad b/src/layouts/60_percent/default.scad index 0280b30..ea60531 100644 --- a/src/layouts/60_percent/default.scad +++ b/src/layouts/60_percent/default.scad @@ -1,6 +1,7 @@ include <../layout.scad> 60_percent_default_layout = [ + [0], // Row 0 (Function keys); blank so other rows get correct height/angle [1,1,1,1,1,1,1,1,1,1,1,1,1,2], [1.5,1,1,1,1,1,1,1,1,1,1,1,1,1.5], [1.75,1,1,1,1,1,1,1,1,1,1,1,2.25], @@ -9,6 +10,7 @@ include <../layout.scad> ]; 60_percent_legends = [ + [""], // blank row 0 again ["`", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "-", "=", "⌫"], ["tab", "q", "w", "e", "r", "t", "y", "u", "i", "o", "p", "[", "]", "\\"], ["caps", "a", "s", "d", "f", "g", "h", "j", "k", "l", ";", "'", "enter"], From d7ea2bf7cc17db019a771c055b0e424c1794f703 Mon Sep 17 00:00:00 2001 From: Matthew Ebersviller Date: Fri, 9 Jul 2021 12:26:42 -0600 Subject: [PATCH 06/10] Editing comment for clarity --- src/layouts/60_percent/default.scad | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/layouts/60_percent/default.scad b/src/layouts/60_percent/default.scad index ea60531..46c7c04 100644 --- a/src/layouts/60_percent/default.scad +++ b/src/layouts/60_percent/default.scad @@ -1,7 +1,7 @@ include <../layout.scad> 60_percent_default_layout = [ - [0], // Row 0 (Function keys); blank so other rows get correct height/angle + [0], // Row 0 (Function keys); blank so other rows get correct depth/angle [1,1,1,1,1,1,1,1,1,1,1,1,1,2], [1.5,1,1,1,1,1,1,1,1,1,1,1,1,1.5], [1.75,1,1,1,1,1,1,1,1,1,1,1,2.25], From 762e45ba3d7e4673d92154700e4855d2a8879730 Mon Sep 17 00:00:00 2001 From: Matthew Ebersviller Date: Wed, 21 Jul 2021 09:48:08 -0600 Subject: [PATCH 07/10] Fixing 60% row offset the correct way --- src/layouts/60_percent/default.scad | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/layouts/60_percent/default.scad b/src/layouts/60_percent/default.scad index 46c7c04..8d43e5a 100644 --- a/src/layouts/60_percent/default.scad +++ b/src/layouts/60_percent/default.scad @@ -1,7 +1,6 @@ include <../layout.scad> 60_percent_default_layout = [ - [0], // Row 0 (Function keys); blank so other rows get correct depth/angle [1,1,1,1,1,1,1,1,1,1,1,1,1,2], [1.5,1,1,1,1,1,1,1,1,1,1,1,1,1.5], [1.75,1,1,1,1,1,1,1,1,1,1,1,2.25], @@ -10,7 +9,6 @@ include <../layout.scad> ]; 60_percent_legends = [ - [""], // blank row 0 again ["`", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "-", "=", "⌫"], ["tab", "q", "w", "e", "r", "t", "y", "u", "i", "o", "p", "[", "]", "\\"], ["caps", "a", "s", "d", "f", "g", "h", "j", "k", "l", ";", "'", "enter"], @@ -19,5 +17,5 @@ include <../layout.scad> ]; module 60_percent_default(profile) { - layout(60_percent_default_layout, profile, 60_percent_legends) children(); + layout(60_percent_default_layout, profile, 60_percent_legends, row_sculpting_offset=1) children(); } From fdce624cb111383209a0afe0b1e4cd4abfdae174 Mon Sep 17 00:00:00 2001 From: Matthew Ebersviller Date: Wed, 21 Jul 2021 11:51:22 -0600 Subject: [PATCH 08/10] Update squared_spherical.scad --- src/dishes/squared_spherical.scad | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dishes/squared_spherical.scad b/src/dishes/squared_spherical.scad index 30859b1..68a5d04 100644 --- a/src/dishes/squared_spherical.scad +++ b/src/dishes/squared_spherical.scad @@ -16,7 +16,7 @@ module squared_spherical_dish(width, height, depth, inverted=false) { // (like -chord) if you want more of a defined circle // in the keywell translate([chord/2, chord/2, -depth]) - sphere(r=r, $fn=64); + sphere(r=r, $fn=128); } } -} \ No newline at end of file +} From 1f1f6a62d23ffafb16746e9a00d38f04d09bb56d Mon Sep 17 00:00:00 2001 From: Matthew Ebersviller Date: Wed, 21 Jul 2021 11:52:19 -0600 Subject: [PATCH 09/10] Added deep_dish to matty3 profile --- src/key_profiles/matty3.scad | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/key_profiles/matty3.scad b/src/key_profiles/matty3.scad index 88232c0..d3e2843 100644 --- a/src/key_profiles/matty3.scad +++ b/src/key_profiles/matty3.scad @@ -2,7 +2,7 @@ // I'm unsure if "MT3" is copyrighted or anything, but // Since my name is "Matt" and "Matty3" sounds like "MT3," // that's what I'm going with for now -module matty3_row(row=3, column=0) { +module matty3_row(row=3, column=0, deep_dish=false) { $key_shape_type = "sculpted_square"; $bottom_key_width = 18.35; @@ -11,7 +11,7 @@ module matty3_row(row=3, column=0) { $width_difference = ($bottom_key_width - 13.0); $height_difference = ($bottom_key_height - 13.0); $dish_type = "squared spherical"; - $dish_depth = 0.75; + $dish_depth = deep_dish ? 1.6 : 0.75; $dish_skew_x = 0; $dish_skew_y = 0; $top_skew = 0; From 8ef5bad8913a2c8eb4d2ea40f26782a715774454 Mon Sep 17 00:00:00 2001 From: Bob Date: Tue, 22 Feb 2022 00:04:20 -0500 Subject: [PATCH 10/10] tweaks on mt3/hipro support --- customizer.scad | 182 +++++++++++++++++---- src/dishes/squared_scoop.scad | 4 +- src/hulls/hull.scad | 30 ++-- src/key_profiles.scad | 9 +- src/key_profiles/hipro.scad | 3 +- src/key_profiles/hipro2.scad | 43 ----- src/key_profiles/{matty3.scad => mt3.scad} | 13 +- src/settings.scad | 7 + src/shapes/sculpted_square.scad | 16 +- 9 files changed, 190 insertions(+), 117 deletions(-) delete mode 100644 src/key_profiles/hipro2.scad rename src/key_profiles/{matty3.scad => mt3.scad} (78%) diff --git a/customizer.scad b/customizer.scad index 8fb6d93..5d70a1f 100644 --- a/customizer.scad +++ b/customizer.scad @@ -214,6 +214,12 @@ $3d_surface_step = 10; // "flat" / "dished" / "disable" $inner_shape_type = "flat"; +// When sculpting sides using sculpted_square, how much in should the tops come +$side_sculpting_factor = 4.5; +// When sculpting corners, how much extra radius should be added +$corner_sculpting_factor = 1; +// When doing more side sculpting corners, how much extra radius should be added +$more_side_sculpting_factor = 0.4; // key width functions module u(u=1) { @@ -509,7 +515,6 @@ module g20_row(row=3, column = 0) { children(); } } -// my own measurements module hipro_row(row=3, column=0) { $key_shape_type = "sculpted_square"; @@ -518,7 +523,7 @@ module hipro_row(row=3, column=0) { $width_difference = ($bottom_key_width - 12.3); $height_difference = ($bottom_key_height - 12.65); - $dish_type = "spherical"; + $dish_type = "squared scoop"; $dish_depth = 0.75; $dish_skew_x = 0; $dish_skew_y = 0; @@ -550,6 +555,57 @@ module hipro_row(row=3, column=0) { children(); } } +// This is an imperfect attempt to clone the MT3 profile +module mt3_row(row=3, column=0, deep_dish=false) { + $key_shape_type = "sculpted_square"; + + $bottom_key_width = 18.35; + $bottom_key_height = 18.6; + + $width_difference = ($bottom_key_width - 13.0); + $height_difference = ($bottom_key_height - 13.0); + $dish_type = "squared spherical"; + $dish_depth = deep_dish ? 1.6 : 1.2; + $dish_skew_x = 0; + $dish_skew_y = 0; + $top_skew = 0; + $height_slices = 10; + $corner_radius = 1; + + $more_side_sculpting_factor = 0.75; + + $top_tilt_y = side_tilt(column); + extra_height = $double_sculpted ? extra_side_tilt_height(column) : 0; + + if (row == 0){ + // TODO I didn't change these yet + $total_depth = 14.7 + extra_height; + $top_tilt = -12.5; + children(); + } else if (row == 1) { + $total_depth = 13.1 + extra_height; + $top_tilt = -6; + children(); + } else if (row == 2) { + $total_depth = 10.7 + extra_height; + $top_tilt = -6; + children(); + } else if (row == 3) { + $total_depth = 10.7 + extra_height; + $top_tilt = 6; + children(); + } else if (row == 4){ + $total_depth = 11.6 + extra_height; + $top_tilt = 12; + children(); + } else if (row >= 5) { + $total_depth = 11.6 + extra_height; + $top_tilt = 0; + children(); + } else { + children(); + } +} module grid_row(row=3, column = 0) { $bottom_key_width = 18.16; $bottom_key_height = 18.16; @@ -787,6 +843,8 @@ module key_profile(key_profile_type, row, column=0) { octagonal_row(row, column) children(); } else if (key_profile_type == "cherry") { cherry_row(row, column) children(); + } else if (key_profile_type == "mt3") { + mt3_row(row, column) children(); } else if (key_profile_type == "disable") { children(); } else { @@ -2104,19 +2162,11 @@ function skin_iso_enter_shape(size, delta, progress, thickness_difference) = ); // rounded square shape with additional sculpting functions to better approximate -// When sculpting sides, how much in should the tops come -side_sculpting_factor = 4.5; -// When sculpting corners, how much extra radius should be added -corner_sculpting_factor = 1; -// When doing more side sculpting corners, how much extra radius should be added -more_side_sculpting_factor = 0.4; - - // side sculpting functions // bows the sides out on stuff like SA and DSA keycaps -function side_sculpting(progress) = (1 - progress) * side_sculpting_factor; +function side_sculpting(progress) = (1 - progress) * $side_sculpting_factor; // makes the rounded corners of the keycap grow larger as they move upwards -function corner_sculpting(progress) = pow(progress, 2) * corner_sculpting_factor; +function corner_sculpting(progress) = pow(progress, 2) * $corner_sculpting_factor; module sculpted_square_shape(size, delta, progress) { width = size[0]; @@ -2141,7 +2191,7 @@ module sculpted_square_shape(size, delta, progress) { offset(r = extra_corner_radius_this_slice, $fa=360/$shape_facets) { offset(r = -extra_corner_radius_this_slice) { - side_rounded_square(square_size, r = more_side_sculpting_factor * progress); + side_rounded_square(square_size, r = $more_side_sculpting_factor * progress); } } } @@ -2196,7 +2246,7 @@ function skin_sculpted_square_shape(size, delta, progress, thickness_difference) width - extra_width_this_slice - thickness_difference, height - extra_height_this_slice - thickness_difference ] - ) new_side_rounded_square(square_size, more_side_sculpting_factor * progress, extra_corner_radius_this_slice); + ) new_side_rounded_square(square_size, $more_side_sculpting_factor * progress, extra_corner_radius_this_slice); module side_rounded_square(size, r) { @@ -4615,6 +4665,62 @@ module spherical_dish(width, height, depth, inverted){ } } } +module squared_spherical_dish(width, height, depth, inverted=false) { + chord = pow(pow(height / 2, 2) + pow(width / 2, 2),0.5); + direction = inverted ? -1 : 1; + r=max(height,width,chord) / 5; + // ^^^^^ Nothing special about this code to figure out r. + // I just modeled up 1u, 1.25u, 1.5u, 2u, 2.25u, and 2.75u + // keys and messed around until I came up with something that + // looked reasonable for all key sizes. This just seems to work + // well for all sizes + + translate([-width / 2, -height / 2, 0 * direction]) { + resize([width, height, depth]) + hull() { + cube([chord,chord,0.001]); + // Use something larger in this translate than -depth + // (like -chord) if you want more of a defined circle + // in the keywell + translate([chord/2, chord/2, -depth]) + sphere(r=r, $fn=128); + } + } +} +module squared_scoop_dish(height, width, depth, r=0.5, inverted=false, num=4, den=5){ + // changable numerator/denoninator on where to place the square's corners + // for example, num=2, den=3 means the dish will happen at 1/3 and 2/3 the + // width and the height. Defaults to 4/5. Customizable when calling + // this module + // + // This was initially intended for the scoop on the HiPro, since that's what + // it uses. Use "hipro_row()" if that's what you'd like. However, I do NOT + // know how close the inner square is for the HiPro keycaps. In fact, it could + // just be a sphere, in which the "squared spherical" scoop is more appropriate. + // If, however, it the "squared scoop" makes sense, you can adjust where the square + // lands with the num (numerator) and den (denominator) variables. For instance, + // "3" and "4" mean 3/4 of the width/height is where the flat part starts. + + chord = pow(pow(height/2, 2) + pow(width/2, 2),0.5); + direction = inverted ? -1 : 1; + + //This is the set of points to hull around for the scoop + points=[ + [height/den - height/2, width/den - width/2, -chord], + [num*height/den - height/2, width/den - width/2, -chord], + [height/den - height/2, num*width/den - width/2, -chord], + [num*height/den - height/2, num*width/den - width/2, -chord] + ]; + + resize([height,width,depth]) + hull() { + shape_slice(1,0,0); + for(i=[0:len(points)-1]) { + translate(points[i]) + sphere(r=r,$fn=64); + } + } +} module flat_dish(width, height, depth, inverted){ cube([width + 100,height + 100, depth], center=true); } @@ -4792,11 +4898,9 @@ geodesic=false; module dish(width, height, depth, inverted) { if($dish_type == "cylindrical"){ cylindrical_dish(width, height, depth, inverted); - } - else if ($dish_type == "spherical") { + } else if ($dish_type == "spherical") { spherical_dish(width, height, depth, inverted); - } - else if ($dish_type == "sideways cylindrical"){ + } else if ($dish_type == "sideways cylindrical"){ sideways_cylindrical_dish(width, height, depth, inverted); } else if ($dish_type == "old spherical") { old_spherical_dish(width, height, depth, inverted); @@ -4806,6 +4910,10 @@ module dish(width, height, depth, inverted) { flat_dish(width, height, depth, inverted); } else if ($dish_type == "disable") { // else no dish + } else if ($dish_type == "squared spherical") { + squared_spherical_dish(width, height, depth, inverted=inverted); + } else if ($dish_type == "squared scoop") { + squared_scoop_dish(width, height, depth, inverted=inverted); } else { echo("WARN: $dish_type unsupported"); } @@ -5089,13 +5197,13 @@ module linear_extrude_shape_hull(thickness_difference, depth_difference, extra_s module hull_shape_hull(thickness_difference, depth_difference, extra_slices = 0) { for (index = [0:$height_slices - 1 + extra_slices]) { hull() { - shape_slice(index / $height_slices, thickness_difference, depth_difference); - shape_slice((index + 1) / $height_slices, thickness_difference, depth_difference); + placed_shape_slice(index / $height_slices, thickness_difference, depth_difference); + placed_shape_slice((index + 1) / $height_slices, thickness_difference, depth_difference); } } } -module shape_slice(progress, thickness_difference, depth_difference) { +module placed_shape_slice(progress, thickness_difference, depth_difference) { skew_this_slice = $top_skew * progress; x_skew_this_slice = $top_skew_x * progress; @@ -5106,20 +5214,24 @@ module shape_slice(progress, thickness_difference, depth_difference) { translate([x_skew_this_slice, skew_this_slice, depth_this_slice]) { rotate([tilt_this_slice,y_tilt_this_slice,0]){ - linear_extrude(height = SMALLEST_POSSIBLE, scale = 1){ - key_shape( - [ - total_key_width(thickness_difference), - total_key_height(thickness_difference) - ], - [$width_difference, $height_difference], - progress - ); - } + shape_slice(progress, thickness_difference, depth_difference); } } } +module shape_slice(progress, thickness_difference, depth_difference) { + linear_extrude(height = SMALLEST_POSSIBLE, scale = 1){ + key_shape( + [ + total_key_width(thickness_difference), + total_key_height(thickness_difference) + ], + [$width_difference, $height_difference], + progress + ); + } +} + // basic key shape, no dish, no inside // which is only used for dishing to cut the dish off correctly // $height_difference used for keytop thickness @@ -6520,7 +6632,13 @@ $3d_surface_step = 10; // "flat" / "dished" / "disable" $inner_shape_type = "flat"; - key(); + +// When sculpting sides using sculpted_square, how much in should the tops come +$side_sculpting_factor = 4.5; +// When sculpting corners, how much extra radius should be added +$corner_sculpting_factor = 1; +// When doing more side sculpting corners, how much extra radius should be added +$more_side_sculpting_factor = 0.4; key(); } if (!$using_customizer) { diff --git a/src/dishes/squared_scoop.scad b/src/dishes/squared_scoop.scad index 366f2a9..17984b9 100644 --- a/src/dishes/squared_scoop.scad +++ b/src/dishes/squared_scoop.scad @@ -5,7 +5,7 @@ module squared_scoop_dish(height, width, depth, r=0.5, inverted=false, num=4, de // this module // // This was initially intended for the scoop on the HiPro, since that's what - // it uses. Use "hipro2_row()" if that's what you'd like. However, I do NOT + // it uses. Use "hipro_row()" if that's what you'd like. However, I do NOT // know how close the inner square is for the HiPro keycaps. In fact, it could // just be a sphere, in which the "squared spherical" scoop is more appropriate. // If, however, it the "squared scoop" makes sense, you can adjust where the square @@ -25,7 +25,7 @@ module squared_scoop_dish(height, width, depth, r=0.5, inverted=false, num=4, de resize([height,width,depth]) hull() { - cube([height,width,0.001],center=true); + shape_slice(1,0,0); for(i=[0:len(points)-1]) { translate(points[i]) sphere(r=r,$fn=64); diff --git a/src/hulls/hull.scad b/src/hulls/hull.scad index af07224..dc29847 100644 --- a/src/hulls/hull.scad +++ b/src/hulls/hull.scad @@ -1,13 +1,13 @@ module hull_shape_hull(thickness_difference, depth_difference, extra_slices = 0) { for (index = [0:$height_slices - 1 + extra_slices]) { hull() { - shape_slice(index / $height_slices, thickness_difference, depth_difference); - shape_slice((index + 1) / $height_slices, thickness_difference, depth_difference); + placed_shape_slice(index / $height_slices, thickness_difference, depth_difference); + placed_shape_slice((index + 1) / $height_slices, thickness_difference, depth_difference); } } } -module shape_slice(progress, thickness_difference, depth_difference) { +module placed_shape_slice(progress, thickness_difference, depth_difference) { skew_this_slice = $top_skew * progress; x_skew_this_slice = $top_skew_x * progress; @@ -18,16 +18,20 @@ module shape_slice(progress, thickness_difference, depth_difference) { translate([x_skew_this_slice, skew_this_slice, depth_this_slice]) { rotate([tilt_this_slice,y_tilt_this_slice,0]){ - linear_extrude(height = SMALLEST_POSSIBLE, scale = 1){ - key_shape( - [ - total_key_width(thickness_difference), - total_key_height(thickness_difference) - ], - [$width_difference, $height_difference], - progress - ); - } + shape_slice(progress, thickness_difference, depth_difference); } } } + +module shape_slice(progress, thickness_difference, depth_difference) { + linear_extrude(height = SMALLEST_POSSIBLE, scale = 1){ + key_shape( + [ + total_key_width(thickness_difference), + total_key_height(thickness_difference) + ], + [$width_difference, $height_difference], + progress + ); + } +} diff --git a/src/key_profiles.scad b/src/key_profiles.scad index 623bddb..f52e615 100644 --- a/src/key_profiles.scad +++ b/src/key_profiles.scad @@ -8,8 +8,7 @@ include include include include -include -include +include include include include @@ -39,10 +38,8 @@ module key_profile(key_profile_type, row, column=0) { octagonal_row(row, column) children(); } else if (key_profile_type == "cherry") { cherry_row(row, column) children(); - } else if (key_profile_type == "hipro2") { - hipro2_row(row, column) children(); - } else if (key_profile_type == "matty3") { - matty3_row(row, column) children(); + } else if (key_profile_type == "mt3") { + mt3_row(row, column) children(); } else if (key_profile_type == "disable") { children(); } else { diff --git a/src/key_profiles/hipro.scad b/src/key_profiles/hipro.scad index 0335a1a..dc8db5d 100644 --- a/src/key_profiles/hipro.scad +++ b/src/key_profiles/hipro.scad @@ -1,4 +1,3 @@ -// my own measurements module hipro_row(row=3, column=0) { $key_shape_type = "sculpted_square"; @@ -7,7 +6,7 @@ module hipro_row(row=3, column=0) { $width_difference = ($bottom_key_width - 12.3); $height_difference = ($bottom_key_height - 12.65); - $dish_type = "spherical"; + $dish_type = "squared scoop"; $dish_depth = 0.75; $dish_skew_x = 0; $dish_skew_y = 0; diff --git a/src/key_profiles/hipro2.scad b/src/key_profiles/hipro2.scad deleted file mode 100644 index bcf75c5..0000000 --- a/src/key_profiles/hipro2.scad +++ /dev/null @@ -1,43 +0,0 @@ -// Takes rsheldiii's hipro profile and adds the "squared scoop" -// dish that appears to be what true HiPros are using up top -// Not perfect as it slightly clips the corners of keys -module hipro2_row(row=3, column=0) { - $key_shape_type = "sculpted_square"; - - $bottom_key_width = 18.35; - $bottom_key_height = 18.17; - - $width_difference = ($bottom_key_width - 12.3); - $height_difference = ($bottom_key_height - 12.65); - $dish_type = "squared scoop"; - $dish_depth = 0.75; - $dish_skew_x = 0; - $dish_skew_y = 0; - $top_skew = 0; - $height_slices = 10; - $corner_radius = 1; - - $top_tilt_y = side_tilt(column); - extra_height = $double_sculpted ? extra_side_tilt_height(column) : 0; - - if (row <= 1){ - $total_depth = 13.7 + extra_height; - // TODO I didn't change these yet - $top_tilt = -13; - children(); - } else if (row == 2) { - $total_depth = 11.1 + extra_height; - $top_tilt = -7; - children(); - } else if (row == 3) { - $total_depth = 11.1 + extra_height; - $top_tilt = 7; - children(); - } else if (row == 4 || row == 5){ - $total_depth = 12.25 + extra_height; - $top_tilt = 13; - children(); - } else { - children(); - } -} diff --git a/src/key_profiles/matty3.scad b/src/key_profiles/mt3.scad similarity index 78% rename from src/key_profiles/matty3.scad rename to src/key_profiles/mt3.scad index d3e2843..d87676a 100644 --- a/src/key_profiles/matty3.scad +++ b/src/key_profiles/mt3.scad @@ -1,8 +1,5 @@ // This is an imperfect attempt to clone the MT3 profile -// I'm unsure if "MT3" is copyrighted or anything, but -// Since my name is "Matt" and "Matty3" sounds like "MT3," -// that's what I'm going with for now -module matty3_row(row=3, column=0, deep_dish=false) { +module mt3_row(row=3, column=0, deep_dish=false) { $key_shape_type = "sculpted_square"; $bottom_key_width = 18.35; @@ -11,20 +8,22 @@ module matty3_row(row=3, column=0, deep_dish=false) { $width_difference = ($bottom_key_width - 13.0); $height_difference = ($bottom_key_height - 13.0); $dish_type = "squared spherical"; - $dish_depth = deep_dish ? 1.6 : 0.75; + $dish_depth = deep_dish ? 1.6 : 1.2; $dish_skew_x = 0; $dish_skew_y = 0; $top_skew = 0; $height_slices = 10; $corner_radius = 1; + $more_side_sculpting_factor = 0.75; + $top_tilt_y = side_tilt(column); extra_height = $double_sculpted ? extra_side_tilt_height(column) : 0; if (row == 0){ // TODO I didn't change these yet - $total_depth = 14.6 + extra_height; - $top_tilt = -12; + $total_depth = 14.7 + extra_height; + $top_tilt = -12.5; children(); } else if (row == 1) { $total_depth = 13.1 + extra_height; diff --git a/src/settings.scad b/src/settings.scad index 90dbe4d..6de0b09 100644 --- a/src/settings.scad +++ b/src/settings.scad @@ -198,3 +198,10 @@ $3d_surface_step = 10; // "flat" / "dished" / "disable" $inner_shape_type = "flat"; + +// When sculpting sides using sculpted_square, how much in should the tops come +$side_sculpting_factor = 4.5; +// When sculpting corners, how much extra radius should be added +$corner_sculpting_factor = 1; +// When doing more side sculpting corners, how much extra radius should be added +$more_side_sculpting_factor = 0.4; \ No newline at end of file diff --git a/src/shapes/sculpted_square.scad b/src/shapes/sculpted_square.scad index 07e3fc4..0e28320 100644 --- a/src/shapes/sculpted_square.scad +++ b/src/shapes/sculpted_square.scad @@ -1,18 +1,10 @@ // rounded square shape with additional sculpting functions to better approximate -// When sculpting sides, how much in should the tops come -side_sculpting_factor = 4.5; -// When sculpting corners, how much extra radius should be added -corner_sculpting_factor = 1; -// When doing more side sculpting corners, how much extra radius should be added -more_side_sculpting_factor = 0.4; - - // side sculpting functions // bows the sides out on stuff like SA and DSA keycaps -function side_sculpting(progress) = (1 - progress) * side_sculpting_factor; +function side_sculpting(progress) = (1 - progress) * $side_sculpting_factor; // makes the rounded corners of the keycap grow larger as they move upwards -function corner_sculpting(progress) = pow(progress, 2) * corner_sculpting_factor; +function corner_sculpting(progress) = pow(progress, 2) * $corner_sculpting_factor; module sculpted_square_shape(size, delta, progress) { width = size[0]; @@ -37,7 +29,7 @@ module sculpted_square_shape(size, delta, progress) { offset(r = extra_corner_radius_this_slice, $fa=360/$shape_facets) { offset(r = -extra_corner_radius_this_slice) { - side_rounded_square(square_size, r = more_side_sculpting_factor * progress); + side_rounded_square(square_size, r = $more_side_sculpting_factor * progress); } } } @@ -92,7 +84,7 @@ function skin_sculpted_square_shape(size, delta, progress, thickness_difference) width - extra_width_this_slice - thickness_difference, height - extra_height_this_slice - thickness_difference ] - ) new_side_rounded_square(square_size, more_side_sculpting_factor * progress, extra_corner_radius_this_slice); + ) new_side_rounded_square(square_size, $more_side_sculpting_factor * progress, extra_corner_radius_this_slice); module side_rounded_square(size, r) {