Merge pull request #65 from rsheldiii/choc-bois-2-choc-men

Add (experimental) Kailh Choc support
This commit is contained in:
Bob 2020-09-30 01:53:34 -04:00 committed by GitHub
commit 33794d3ea9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 162 additions and 3 deletions

View File

@ -11,6 +11,15 @@ CHANGELOG:
* side-printed keycaps are first class! you can use the `sideways()` modifier to set up sideways keycaps that have flat sides to print on. * side-printed keycaps are first class! you can use the `sideways()` modifier to set up sideways keycaps that have flat sides to print on.
* it's much easier to make quick artisans now that the inside of the keycap is differenced from any additive features placed on top * it's much easier to make quick artisans now that the inside of the keycap is differenced from any additive features placed on top
* `$linear_extrude_shape` and `$skin_extrude_shape` retired in favor of `$hull_shape_type` * `$linear_extrude_shape` and `$skin_extrude_shape` retired in favor of `$hull_shape_type`
* still todo: add a magic scaling variable so you can scale the whole world up, see if that fixes degeneracy * added regular_polygon shape and octagonal and hexagonal key profiles
* still todo: rejigger supports * added beta kailh choc
* still todo: rejigger inner shape. maybe just always make it flat * Finally got ISO Enter working correctly!
* STILL TODO:
* add a magic scaling variable so you can scale the whole world up, see if that fixes degeneracy
* Make flat stem support default
* make flat inner shape default
* new_key_structure changes doesn't take into account support stems properly; fix
* support repositioning to print on the back surface of the keycap
* implement regular polygon for skin extrusions
* switch to skin-shaped extrusions by default
* kailh choc has a non-square key unit; should I get that working for layouts etc?

View File

@ -178,6 +178,9 @@ $inset_legend_depth = 0.2;
// Dimensions of alps stem // Dimensions of alps stem
$alps_stem = [4.45, 2.25]; $alps_stem = [4.45, 2.25];
// Dimensions of choc stem
$choc_stem = [1.2, 3];
// Enable stabilizer stems, to hold onto your cherry or costar stabilizers // Enable stabilizer stems, to hold onto your cherry or costar stabilizers
$stabilizer_type = "costar_stabilizer"; // [costar_stabilizer, cherry_stabilizer, disable] $stabilizer_type = "costar_stabilizer"; // [costar_stabilizer, cherry_stabilizer, disable]
@ -858,6 +861,34 @@ module box_cherry(slop) {
children(); children();
} }
module choc(slop = 0.05) {
echo("WARN:\n\n * choc support is experimental.\n * $stem_slop is overridden.\n * it is also recommended to print them upside down if you can\n\n");
$stem_throw = 3;
$stem_slop = slop;
$bottom_key_width = 18;
$bottom_key_height = 17;
$stem_type = "choc";
children();
}
// a hacky way to make "low profile" keycaps
module low_profile() {
$width_difference = $width_difference / 1.5;
$height_difference = $height_difference / 1.5;
// helps tilted keycaps not have holes if worst comes to worst
$inner_shape_type = "dished";
$top_tilt = $top_tilt / 1.25;
$total_depth = ($total_depth / 2) < 7 ? 7 : $total_depth / 2;
// just to make sure
$stem_throw = 3;
children();
}
module flared_support() { module flared_support() {
$support_type = "flared"; $support_type = "flared";
children(); children();
@ -2078,6 +2109,22 @@ module cherry_stabilizer_stem(depth, slop) {
inside_cherry_stabilizer_cross(slop); inside_cherry_stabilizer_cross(slop);
} }
} }
separation = 5.7;
positions = [
[separation/2, 0],
[-separation/2, 0],
];
module choc_stem(depth, slop){
for (position=positions) {
translate([position.x,position.y, depth/2]) single_choc_stem(depth, slop);
}
}
module single_choc_stem(depth, slop) {
cube([$choc_stem.x - slop, $choc_stem.y - slop, depth], center=true);
}
//whole stem, alps or cherry, trimmed to fit //whole stem, alps or cherry, trimmed to fit
@ -2094,6 +2141,8 @@ module stem(stem_type, depth, slop){
filled_stem(); filled_stem();
} else if (stem_type == "cherry_stabilizer") { } else if (stem_type == "cherry_stabilizer") {
cherry_stabilizer_stem(depth, slop); cherry_stabilizer_stem(depth, slop);
} else if (stem_type == "choc") {
choc_stem(depth, slop);
} else if (stem_type == "disable") { } else if (stem_type == "disable") {
children(); children();
} else { } else {
@ -2322,6 +2371,18 @@ module brim_support(stem_type, stem_support_height, slop) {
inside_cherry_cross(slop); inside_cherry_cross(slop);
} }
} else if(stem_type == "choc") {
translate([-5.7/2,0,0]) linear_extrude(height=stem_support_height) {
offset(r=1){
square($choc_stem + [3,3], center=true);
}
}
translate([5.7/2,0,0]) linear_extrude(height=stem_support_height) {
offset(r=1){
square($choc_stem + [3,3], center=true);
}
}
} }
} }
// a safe theoretical distance between two vertices such that they don't collapse. hard to use // a safe theoretical distance between two vertices such that they don't collapse. hard to use
@ -2579,6 +2640,10 @@ module tines_support(stem_type, stem_support_height, slop) {
} }
} else if (stem_type == "alps"){ } else if (stem_type == "alps"){
centered_tines(stem_support_height); centered_tines(stem_support_height);
} else if (stem_type == "choc"){
if ($key_length < 2) translate([0,0,$stem_support_height / 2]) cube([total_key_width($wall_thickness)+$wall_thickness/4, 0.42, $stem_support_height], center = true);
/* translate([-5.7/2,0,$stem_support_height / 2]) cube([0.5, total_key_height($wall_thickness), $stem_support_height], center = true); */
/* translate([5.7/2,0,$stem_support_height / 2]) cube([0.5, total_key_height($wall_thickness), $stem_support_height], center = true); */
} }
} }
@ -2932,6 +2997,14 @@ module flared(stem_type, loft, height) {
square(outer_cherry_stabilizer_stem($stem_slop) - [2,2], center=true); square(outer_cherry_stabilizer_stem($stem_slop) - [2,2], center=true);
} }
} }
} else if (stem_type == "choc") {
// single support, just the stem
new_choc_scale = [scale_for_45(height, $choc_stem[0] + 5.7 - $stem_slop), scale_for_45(height, $choc_stem[1])];
translate([0,0,0]) linear_extrude(height=height, scale = new_choc_scale){
// TODO make a choc_stem() function so it can build in the slop
square([$choc_stem[0] + 5.7 - $stem_slop, $choc_stem[1] - $stem_slop], center=true);
}
} else { } else {
// always render cherry if no stem type. this includes stem_type = false! // always render cherry if no stem type. this includes stem_type = false!
// this avoids a bug where the keycap is rendered filled when not desired // this avoids a bug where the keycap is rendered filled when not desired
@ -4473,6 +4546,9 @@ $inset_legend_depth = 0.2;
// Dimensions of alps stem // Dimensions of alps stem
$alps_stem = [4.45, 2.25]; $alps_stem = [4.45, 2.25];
// Dimensions of choc stem
$choc_stem = [1.2, 3];
// Enable stabilizer stems, to hold onto your cherry or costar stabilizers // Enable stabilizer stems, to hold onto your cherry or costar stabilizers
$stabilizer_type = "costar_stabilizer"; // [costar_stabilizer, cherry_stabilizer, disable] $stabilizer_type = "costar_stabilizer"; // [costar_stabilizer, cherry_stabilizer, disable]

View File

@ -109,6 +109,34 @@ module box_cherry(slop) {
children(); children();
} }
module choc(slop = 0.05) {
echo("WARN:\n\n * choc support is experimental.\n * $stem_slop is overridden.\n * it is also recommended to print them upside down if you can\n\n");
$stem_throw = 3;
$stem_slop = slop;
$bottom_key_width = 18;
$bottom_key_height = 17;
$stem_type = "choc";
children();
}
// a hacky way to make "low profile" keycaps
module low_profile() {
$width_difference = $width_difference / 1.5;
$height_difference = $height_difference / 1.5;
// helps tilted keycaps not have holes if worst comes to worst
$inner_shape_type = "dished";
$top_tilt = $top_tilt / 1.25;
$total_depth = ($total_depth / 2) < 7 ? 7 : $total_depth / 2;
// just to make sure
$stem_throw = 3;
children();
}
module flared_support() { module flared_support() {
$support_type = "flared"; $support_type = "flared";
children(); children();

View File

@ -163,6 +163,9 @@ $inset_legend_depth = 0.2;
// Dimensions of alps stem // Dimensions of alps stem
$alps_stem = [4.45, 2.25]; $alps_stem = [4.45, 2.25];
// Dimensions of choc stem
$choc_stem = [1.2, 3];
// Enable stabilizer stems, to hold onto your cherry or costar stabilizers // Enable stabilizer stems, to hold onto your cherry or costar stabilizers
$stabilizer_type = "costar_stabilizer"; // [costar_stabilizer, cherry_stabilizer, disable] $stabilizer_type = "costar_stabilizer"; // [costar_stabilizer, cherry_stabilizer, disable]

View File

@ -43,5 +43,17 @@ module brim_support(stem_type, stem_support_height, slop) {
inside_cherry_cross(slop); inside_cherry_cross(slop);
} }
} else if(stem_type == "choc") {
translate([-5.7/2,0,0]) linear_extrude(height=stem_support_height) {
offset(r=1){
square($choc_stem + [3,3], center=true);
}
}
translate([5.7/2,0,0]) linear_extrude(height=stem_support_height) {
offset(r=1){
square($choc_stem + [3,3], center=true);
}
}
} }
} }

View File

@ -77,5 +77,9 @@ module tines_support(stem_type, stem_support_height, slop) {
} }
} else if (stem_type == "alps"){ } else if (stem_type == "alps"){
centered_tines(stem_support_height); centered_tines(stem_support_height);
} else if (stem_type == "choc"){
if ($key_length < 2) translate([0,0,$stem_support_height / 2]) cube([total_key_width($wall_thickness)+$wall_thickness/4, 0.42, $stem_support_height], center = true);
/* translate([-5.7/2,0,$stem_support_height / 2]) cube([0.5, total_key_height($wall_thickness), $stem_support_height], center = true); */
/* translate([5.7/2,0,$stem_support_height / 2]) cube([0.5, total_key_height($wall_thickness), $stem_support_height], center = true); */
} }
} }

View File

@ -4,6 +4,7 @@ include <stems/box_cherry.scad>
include <stems/alps.scad> include <stems/alps.scad>
include <stems/filled.scad> include <stems/filled.scad>
include <stems/cherry_stabilizer.scad> include <stems/cherry_stabilizer.scad>
include <stems/choc.scad>
//whole stem, alps or cherry, trimmed to fit //whole stem, alps or cherry, trimmed to fit
@ -20,6 +21,8 @@ module stem(stem_type, depth, slop){
filled_stem(); filled_stem();
} else if (stem_type == "cherry_stabilizer") { } else if (stem_type == "cherry_stabilizer") {
cherry_stabilizer_stem(depth, slop); cherry_stabilizer_stem(depth, slop);
} else if (stem_type == "choc") {
choc_stem(depth, slop);
} else if (stem_type == "disable") { } else if (stem_type == "disable") {
children(); children();
} else { } else {

16
src/stems/choc.scad Normal file
View File

@ -0,0 +1,16 @@
separation = 5.7;
positions = [
[separation/2, 0],
[-separation/2, 0],
];
module choc_stem(depth, slop){
for (position=positions) {
translate([position.x,position.y, depth/2]) single_choc_stem(depth, slop);
}
}
module single_choc_stem(depth, slop) {
cube([$choc_stem.x - slop, $choc_stem.y - slop, depth], center=true);
}

View File

@ -40,6 +40,14 @@ module flared(stem_type, loft, height) {
square(outer_cherry_stabilizer_stem($stem_slop) - [2,2], center=true); square(outer_cherry_stabilizer_stem($stem_slop) - [2,2], center=true);
} }
} }
} else if (stem_type == "choc") {
// single support, just the stem
new_choc_scale = [scale_for_45(height, $choc_stem[0] + 5.7 - $stem_slop), scale_for_45(height, $choc_stem[1])];
translate([0,0,0]) linear_extrude(height=height, scale = new_choc_scale){
// TODO make a choc_stem() function so it can build in the slop
square([$choc_stem[0] + 5.7 - $stem_slop, $choc_stem[1] - $stem_slop], center=true);
}
} else { } else {
// always render cherry if no stem type. this includes stem_type = false! // always render cherry if no stem type. this includes stem_type = false!
// this avoids a bug where the keycap is rendered filled when not desired // this avoids a bug where the keycap is rendered filled when not desired