Update choc for prime time

mostly just tweaks
This commit is contained in:
Bob 2020-09-30 01:35:09 -04:00
parent b73b9346a4
commit dfbd88e065
4 changed files with 82 additions and 54 deletions

View File

@ -861,12 +861,34 @@ module box_cherry(slop) {
children(); children();
} }
module choc(slop) { module choc(slop = 0.05) {
$stem_slop = slop ? slop : $stem_slop; 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"; $stem_type = "choc";
children(); 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();
@ -934,14 +956,6 @@ module debug() {
%children(); %children();
} }
module low_profile() {
/* $total_depth = 5.35; */
/* extra ugly hack right now to make sure we don't generate keycaps with insufficient throw */
/* $total_depth = ($total_depth / 2) < 6 ? 6 : $total_depth / 2; */
$stem_throw = 3;
children();
}
module arrows(profile, rows = [4,4,4,3]) { module arrows(profile, rows = [4,4,4,3]) {
positions = [[0, 0], [1, 0], [2, 0], [1, 1]]; positions = [[0, 0], [1, 0], [2, 0], [1, 1]];
legends = ["←", "↓", "→", "↑"]; legends = ["←", "↓", "→", "↑"];
@ -2095,11 +2109,21 @@ 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){ module choc_stem(depth, slop){
echo("slop"); for (position=positions) {
echo(slop); translate([position.x,position.y, depth/2]) single_choc_stem(depth, slop);
translate([-5.7/2, 0, depth/2]) cube([1.2 - slop/2, 3 - slop/2, depth], center=true); }
translate([5.7/2, 0, depth/2]) cube([1.2 - slop/2, 3 - slop/2, depth], center=true); }
module single_choc_stem(depth, slop) {
cube([$choc_stem.x - slop, $choc_stem.y - slop, depth], center=true);
} }
@ -2617,7 +2641,7 @@ 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"){ } 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.5, $stem_support_height], center = true); 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); */
/* 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); */
} }
@ -2974,14 +2998,13 @@ module flared(stem_type, loft, height) {
} }
} }
} else if (stem_type == "choc") { } else if (stem_type == "choc") {
alps_scale = [scale_for_45(height, $choc_stem[0]), scale_for_45(height, $choc_stem[1])]; // single support, just the stem
translate([-5.7/2,0,0]) linear_extrude(height=height, scale = alps_scale){ new_choc_scale = [scale_for_45(height, $choc_stem[0] + 5.7 - $stem_slop), scale_for_45(height, $choc_stem[1])];
square($choc_stem - [$stem_slop/2, $stem_slop/2], center=true); 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);
} }
translate([5.7/2,0,0]) linear_extrude(height=height, scale = alps_scale){
square($choc_stem - [$stem_slop/2, $stem_slop/2], 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

View File

@ -109,12 +109,34 @@ module box_cherry(slop) {
children(); children();
} }
module choc(slop) { module choc(slop = 0.05) {
$stem_slop = slop ? slop : $stem_slop; 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"; $stem_type = "choc";
children(); 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();
@ -182,11 +204,3 @@ module debug() {
%children(); %children();
} }
module low_profile() {
/* $total_depth = 5.35; */
/* extra ugly hack right now to make sure we don't generate keycaps with insufficient throw */
/* $total_depth = ($total_depth / 2) < 6 ? 6 : $total_depth / 2; */
$stem_throw = 3;
children();
}

View File

@ -1,5 +1,16 @@
module choc_stem(depth, slop){ separation = 5.7;
translate([-5.7/2, 0, depth/2]) cube([1.2 - slop, 3 - slop / 2, depth], center=true); positions = [
translate([5.7/2, 0, depth/2]) cube([1.2 - slop, 3 - slop / 2, depth], center=true); [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

@ -41,26 +41,6 @@ module flared(stem_type, loft, height) {
} }
} }
} else if (stem_type == "choc") { } else if (stem_type == "choc") {
choc_scale = [scale_for_45(height, $choc_stem[0]), scale_for_45(height, $choc_stem[1])];
// double support
/*
translate([-5.7/2,0,0]) linear_extrude(height=height, scale = choc_scale){
// TODO make a choc_stem() function so it can build in the slop
square($choc_stem - [$stem_slop, $stem_slop], center=true);
}
translate([5.7/2,0,0]) linear_extrude(height=height, scale = choc_scale){
square($choc_stem - [$stem_slop, $stem_slop], center=true);
} */
// single support, full width
/* translate([0,0,0]) linear_extrude(height=height, scale = choc_scale){
// TODO make a choc_stem() function so it can build in the slop
square([total_key_width($wall_thickness), $choc_stem[1] - $stem_slop], center=true);
} */
// single support, just the stem // 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])]; 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){ translate([0,0,0]) linear_extrude(height=height, scale = new_choc_scale){