Make tine support work for offset stems

Also remove extra_long_stem_support as it doesn't work with the new
structure
This commit is contained in:
Bob 2022-02-21 12:55:17 -05:00
parent aad8ddc558
commit feb9ec6a71
4 changed files with 23 additions and 35 deletions

View File

@ -78,7 +78,7 @@ These modifier functions may not cover every use case; in that case, you may hav
new to the library and still in a beta state, layouts allows you to generate an entire layout for a keyboard!
It is recommended to use tined stem support and set `$extra_long_stem_support = true` if you plan on printing these keycaps.
It is recommended to print layouts with a brim that extends to the next key.
```
60_percent_default("dcs") key();

View File

@ -94,10 +94,6 @@ $stem_inset = 0;
// How many degrees to rotate the stems. useful for sideways keycaps, maybe
$stem_rotation = 0;
// enable to have stem support extend past the keycap bottom, to (hopefully) the next
// keycap. only works on tines right now
$extra_long_stem_support = false;
/* [Shape] */
// Key shape type, determines the shape of the key. default is 'rounded square'
@ -4330,17 +4326,20 @@ module cherry_stem(depth, slop, throw) {
}
}
/* NOTE: every reference to total_key_width and total_key_height
* is multiplied by two in order to account for offset stems
*/
module centered_tines(stem_support_height) {
if ($key_length < 2) {
translate([0,0,$stem_support_height / 2]) {
cube([total_key_width(), 0.5, $stem_support_height], center = true);
cube([total_key_width()*2, 0.5, $stem_support_height], center = true);
}
}
translate([0,0,$stem_support_height / 2]) {
cube([
1,
total_key_height(),
total_key_height()*2,
$stem_support_height
],
center = true);
@ -4348,16 +4347,13 @@ module centered_tines(stem_support_height) {
}
module tines_support(stem_type, stem_support_height, slop) {
extra_height = $extra_long_stem_support ? ($unit - total_key_height()) + 0.1 : -$wall_thickness/4; // fudge
extra_width = $extra_long_stem_support ? ($unit - total_key_width()) + 0.1 : -$wall_thickness/4;
if (stem_type == "cherry" || stem_type == "costar_stabilizer") {
difference () {
union() {
if ($key_length < 2) {
translate([0,0,$stem_support_height / 2]) {
cube([
total_key_width() + extra_width*2,
total_key_width()*2,
0.5,
$stem_support_height
], center = true);
@ -4369,7 +4365,7 @@ module tines_support(stem_type, stem_support_height, slop) {
translate([x,0,$stem_support_height / 2]) {
cube([
0.5,
total_key_height() + extra_height*2, // this is to extend past
total_key_height()*2, // this is to extend past
$stem_support_height
], center = true);
}
@ -4384,7 +4380,7 @@ module tines_support(stem_type, stem_support_height, slop) {
translate([x,0,$stem_support_height / 2]) {
cube([
1,
total_key_height($wall_thickness),
total_key_height()*2,
$stem_support_height
], center = true);
}
@ -4407,9 +4403,9 @@ module tines_support(stem_type, stem_support_height, slop) {
} else if (stem_type == "alps"){
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); */
if ($key_length < 2) translate([0,0,$stem_support_height / 2]) cube([total_key_width(), 0.42, $stem_support_height], center = true);
/* translate([-5.7/2,0,$stem_support_height / 2]) cube([0.5, total_key_height(), $stem_support_height], center = true); */
/* translate([5.7/2,0,$stem_support_height / 2]) cube([0.5, total_key_height(), $stem_support_height], center = true); */
}
}
@ -6404,10 +6400,6 @@ $stem_inset = 0;
// How many degrees to rotate the stems. useful for sideways keycaps, maybe
$stem_rotation = 0;
// enable to have stem support extend past the keycap bottom, to (hopefully) the next
// keycap. only works on tines right now
$extra_long_stem_support = false;
/* [Shape] */
// Key shape type, determines the shape of the key. default is 'rounded square'

View File

@ -79,10 +79,6 @@ $stem_inset = 0;
// How many degrees to rotate the stems. useful for sideways keycaps, maybe
$stem_rotation = 0;
// enable to have stem support extend past the keycap bottom, to (hopefully) the next
// keycap. only works on tines right now
$extra_long_stem_support = false;
/* [Shape] */
// Key shape type, determines the shape of the key. default is 'rounded square'

View File

@ -1,17 +1,20 @@
include <../functions.scad>
include <../stems/cherry.scad>
/* NOTE: every reference to total_key_width and total_key_height
* is multiplied by two in order to account for offset stems
*/
module centered_tines(stem_support_height) {
if ($key_length < 2) {
translate([0,0,$stem_support_height / 2]) {
cube([total_key_width(), 0.5, $stem_support_height], center = true);
cube([total_key_width()*2, 0.5, $stem_support_height], center = true);
}
}
translate([0,0,$stem_support_height / 2]) {
cube([
1,
total_key_height(),
total_key_height()*2,
$stem_support_height
],
center = true);
@ -19,16 +22,13 @@ module centered_tines(stem_support_height) {
}
module tines_support(stem_type, stem_support_height, slop) {
extra_height = $extra_long_stem_support ? ($unit - total_key_height()) + 0.1 : -$wall_thickness/4; // fudge
extra_width = $extra_long_stem_support ? ($unit - total_key_width()) + 0.1 : -$wall_thickness/4;
if (stem_type == "cherry" || stem_type == "costar_stabilizer") {
difference () {
union() {
if ($key_length < 2) {
translate([0,0,$stem_support_height / 2]) {
cube([
total_key_width() + extra_width*2,
total_key_width()*2,
0.5,
$stem_support_height
], center = true);
@ -40,7 +40,7 @@ module tines_support(stem_type, stem_support_height, slop) {
translate([x,0,$stem_support_height / 2]) {
cube([
0.5,
total_key_height() + extra_height*2, // this is to extend past
total_key_height()*2, // this is to extend past
$stem_support_height
], center = true);
}
@ -55,7 +55,7 @@ module tines_support(stem_type, stem_support_height, slop) {
translate([x,0,$stem_support_height / 2]) {
cube([
1,
total_key_height($wall_thickness),
total_key_height()*2,
$stem_support_height
], center = true);
}
@ -78,8 +78,8 @@ module tines_support(stem_type, stem_support_height, slop) {
} else if (stem_type == "alps"){
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); */
if ($key_length < 2) translate([0,0,$stem_support_height / 2]) cube([total_key_width(), 0.42, $stem_support_height], center = true);
/* translate([-5.7/2,0,$stem_support_height / 2]) cube([0.5, total_key_height(), $stem_support_height], center = true); */
/* translate([5.7/2,0,$stem_support_height / 2]) cube([0.5, total_key_height(), $stem_support_height], center = true); */
}
}