mirror of
https://github.com/rsheldiii/KeyV2.git
synced 2024-11-29 16:13:06 +00:00
Merge pull request #147 from rsheldiii/v2/offset-stem-support
V2: Make tine support work for offset stems, remove $extra_long_stem_support
This commit is contained in:
commit
75cfa2a856
@ -90,7 +90,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!
|
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();
|
60_percent_default("dcs") key();
|
||||||
|
@ -94,10 +94,6 @@ $stem_inset = 0;
|
|||||||
// How many degrees to rotate the stems. useful for sideways keycaps, maybe
|
// How many degrees to rotate the stems. useful for sideways keycaps, maybe
|
||||||
$stem_rotation = 0;
|
$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] */
|
/* [Shape] */
|
||||||
|
|
||||||
// Key shape type, determines the shape of the key. default is 'rounded square'
|
// 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) {
|
module centered_tines(stem_support_height) {
|
||||||
if ($key_length < 2) {
|
if ($key_length < 2) {
|
||||||
translate([0,0,$stem_support_height / 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]) {
|
translate([0,0,$stem_support_height / 2]) {
|
||||||
cube([
|
cube([
|
||||||
1,
|
1,
|
||||||
total_key_height(),
|
total_key_height()*2,
|
||||||
$stem_support_height
|
$stem_support_height
|
||||||
],
|
],
|
||||||
center = true);
|
center = true);
|
||||||
@ -4348,16 +4347,13 @@ module centered_tines(stem_support_height) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
module tines_support(stem_type, stem_support_height, slop) {
|
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") {
|
if (stem_type == "cherry" || stem_type == "costar_stabilizer") {
|
||||||
difference () {
|
difference () {
|
||||||
union() {
|
union() {
|
||||||
if ($key_length < 2) {
|
if ($key_length < 2) {
|
||||||
translate([0,0,$stem_support_height / 2]) {
|
translate([0,0,$stem_support_height / 2]) {
|
||||||
cube([
|
cube([
|
||||||
total_key_width() + extra_width*2,
|
total_key_width()*2,
|
||||||
0.5,
|
0.5,
|
||||||
$stem_support_height
|
$stem_support_height
|
||||||
], center = true);
|
], center = true);
|
||||||
@ -4369,7 +4365,7 @@ module tines_support(stem_type, stem_support_height, slop) {
|
|||||||
translate([x,0,$stem_support_height / 2]) {
|
translate([x,0,$stem_support_height / 2]) {
|
||||||
cube([
|
cube([
|
||||||
0.5,
|
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
|
$stem_support_height
|
||||||
], center = true);
|
], center = true);
|
||||||
}
|
}
|
||||||
@ -4384,7 +4380,7 @@ module tines_support(stem_type, stem_support_height, slop) {
|
|||||||
translate([x,0,$stem_support_height / 2]) {
|
translate([x,0,$stem_support_height / 2]) {
|
||||||
cube([
|
cube([
|
||||||
1,
|
1,
|
||||||
total_key_height($wall_thickness),
|
total_key_height()*2,
|
||||||
$stem_support_height
|
$stem_support_height
|
||||||
], center = true);
|
], center = true);
|
||||||
}
|
}
|
||||||
@ -4407,9 +4403,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"){
|
} 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);
|
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($wall_thickness), $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($wall_thickness), $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
|
// How many degrees to rotate the stems. useful for sideways keycaps, maybe
|
||||||
$stem_rotation = 0;
|
$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] */
|
/* [Shape] */
|
||||||
|
|
||||||
// Key shape type, determines the shape of the key. default is 'rounded square'
|
// Key shape type, determines the shape of the key. default is 'rounded square'
|
||||||
|
@ -79,10 +79,6 @@ $stem_inset = 0;
|
|||||||
// How many degrees to rotate the stems. useful for sideways keycaps, maybe
|
// How many degrees to rotate the stems. useful for sideways keycaps, maybe
|
||||||
$stem_rotation = 0;
|
$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] */
|
/* [Shape] */
|
||||||
|
|
||||||
// Key shape type, determines the shape of the key. default is 'rounded square'
|
// Key shape type, determines the shape of the key. default is 'rounded square'
|
||||||
|
@ -1,17 +1,20 @@
|
|||||||
include <../functions.scad>
|
include <../functions.scad>
|
||||||
include <../stems/cherry.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) {
|
module centered_tines(stem_support_height) {
|
||||||
if ($key_length < 2) {
|
if ($key_length < 2) {
|
||||||
translate([0,0,$stem_support_height / 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]) {
|
translate([0,0,$stem_support_height / 2]) {
|
||||||
cube([
|
cube([
|
||||||
1,
|
1,
|
||||||
total_key_height(),
|
total_key_height()*2,
|
||||||
$stem_support_height
|
$stem_support_height
|
||||||
],
|
],
|
||||||
center = true);
|
center = true);
|
||||||
@ -19,16 +22,13 @@ module centered_tines(stem_support_height) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
module tines_support(stem_type, stem_support_height, slop) {
|
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") {
|
if (stem_type == "cherry" || stem_type == "costar_stabilizer") {
|
||||||
difference () {
|
difference () {
|
||||||
union() {
|
union() {
|
||||||
if ($key_length < 2) {
|
if ($key_length < 2) {
|
||||||
translate([0,0,$stem_support_height / 2]) {
|
translate([0,0,$stem_support_height / 2]) {
|
||||||
cube([
|
cube([
|
||||||
total_key_width() + extra_width*2,
|
total_key_width()*2,
|
||||||
0.5,
|
0.5,
|
||||||
$stem_support_height
|
$stem_support_height
|
||||||
], center = true);
|
], center = true);
|
||||||
@ -40,7 +40,7 @@ module tines_support(stem_type, stem_support_height, slop) {
|
|||||||
translate([x,0,$stem_support_height / 2]) {
|
translate([x,0,$stem_support_height / 2]) {
|
||||||
cube([
|
cube([
|
||||||
0.5,
|
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
|
$stem_support_height
|
||||||
], center = true);
|
], center = true);
|
||||||
}
|
}
|
||||||
@ -55,7 +55,7 @@ module tines_support(stem_type, stem_support_height, slop) {
|
|||||||
translate([x,0,$stem_support_height / 2]) {
|
translate([x,0,$stem_support_height / 2]) {
|
||||||
cube([
|
cube([
|
||||||
1,
|
1,
|
||||||
total_key_height($wall_thickness),
|
total_key_height()*2,
|
||||||
$stem_support_height
|
$stem_support_height
|
||||||
], center = true);
|
], center = true);
|
||||||
}
|
}
|
||||||
@ -78,8 +78,8 @@ 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.42, $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($wall_thickness), $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($wall_thickness), $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); */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user