mirror of
https://github.com/rsheldiii/KeyV2.git
synced 2026-01-14 14:27:55 -05:00
Compare commits
1 Commits
v2.1.2
...
force-iso-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6845923913 |
16
README.md
16
README.md
@@ -25,19 +25,7 @@ If you are technically inclined at all, this is definitely the best way to run t
|
||||
|
||||
First, you'll need OpenSCAD: http://www.openscad.org/downloads.html. I highly recommend installing the development snapshot, as they generally support more features and are relatively stable. Development snapshots are listed in their own section on the downloads page.
|
||||
|
||||
After you have openSCAD installed, you need to download the code and run it. running `git clone https://github.com/rsheldiii/openSCAD-projects.git` if you have git, or downloading [this zip](https://github.com/rsheldiii/openSCAD-projects/archive/master.zip) and extracting the directory should do it.
|
||||
|
||||
To make your own key, all you need to do is open `keys.scad` with openSCAD and modify this line:
|
||||
|
||||
```
|
||||
dcs_row(5) legend("⇪", size=9) key();
|
||||
```
|
||||
|
||||
To be whatever you want. For example, this is for a ctrl key on an OEM keyboard:
|
||||
|
||||
```u(1.25) oem_row(3) legend("ctrl", size=4.5) key();```
|
||||
|
||||
It is possible to edit this project with an external editor by checking off Design => 'Automatic Reload and Preview' in OpenSCAD.
|
||||
After you have openSCAD installed, you need to download the code and run it. running `git clone https://github.com/rsheldiii/KeyV2.git` if you have git, or downloading [this zip](https://github.com/rsheldiii/KeyV2/archive/master.zip) and extracting the directory should do it. Then all you need to do is open `keys.scad` with openSCAD and you are set! It is possible to edit this project with an external editor by checking off Design => 'Automatic Reload and Preview' in OpenSCAD.
|
||||
|
||||
All examples below assume you are running the library on your computer with OpenSCAD.
|
||||
|
||||
@@ -90,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 print layouts with a brim that extends to the next key.
|
||||
It is recommended to use tined stem support and set `$extra_long_stem_support = true` if you plan on printing these keycaps.
|
||||
|
||||
```
|
||||
60_percent_default("dcs") key();
|
||||
|
||||
1
TODO.md
1
TODO.md
@@ -1,5 +1,6 @@
|
||||
TODO:
|
||||
* Make flat stem support default
|
||||
* make flat inner shape default
|
||||
* support repositioning to print on the back surface of the keycap
|
||||
* implement regular polygon for skin extrusions
|
||||
* switch to skin-shaped extrusions by default
|
||||
|
||||
103
customizer.scad
103
customizer.scad
@@ -94,6 +94,10 @@ $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'
|
||||
@@ -831,7 +835,7 @@ function top_total_key_height() = $bottom_key_height + ($unit * ($key_height - 1
|
||||
|
||||
function side_tilt(column) = asin($unit * column / $double_sculpt_radius);
|
||||
// tan of 0 is 0, division by 0 is nan, so we have to guard
|
||||
function extra_side_tilt_height(column) = side_tilt(column) ? ($double_sculpt_radius - ($unit * abs(column)) / tan(abs(side_tilt(column)))) : 0;
|
||||
function extra_side_tilt_height(column) = side_tilt(column) ? ($double_sculpt_radius - (unit * abs(column)) / tan(abs(side_tilt(column)))) : 0;
|
||||
|
||||
// (I think) extra length of the side of the keycap due to the keytop being tilted.
|
||||
// necessary for calculating flat sided keycaps
|
||||
@@ -1232,7 +1236,7 @@ function top_total_key_height() = $bottom_key_height + ($unit * ($key_height - 1
|
||||
|
||||
function side_tilt(column) = asin($unit * column / $double_sculpt_radius);
|
||||
// tan of 0 is 0, division by 0 is nan, so we have to guard
|
||||
function extra_side_tilt_height(column) = side_tilt(column) ? ($double_sculpt_radius - ($unit * abs(column)) / tan(abs(side_tilt(column)))) : 0;
|
||||
function extra_side_tilt_height(column) = side_tilt(column) ? ($double_sculpt_radius - (unit * abs(column)) / tan(abs(side_tilt(column)))) : 0;
|
||||
|
||||
// (I think) extra length of the side of the keycap due to the keytop being tilted.
|
||||
// necessary for calculating flat sided keycaps
|
||||
@@ -1311,7 +1315,7 @@ function top_total_key_height() = $bottom_key_height + ($unit * ($key_height - 1
|
||||
|
||||
function side_tilt(column) = asin($unit * column / $double_sculpt_radius);
|
||||
// tan of 0 is 0, division by 0 is nan, so we have to guard
|
||||
function extra_side_tilt_height(column) = side_tilt(column) ? ($double_sculpt_radius - ($unit * abs(column)) / tan(abs(side_tilt(column)))) : 0;
|
||||
function extra_side_tilt_height(column) = side_tilt(column) ? ($double_sculpt_radius - (unit * abs(column)) / tan(abs(side_tilt(column)))) : 0;
|
||||
|
||||
// (I think) extra length of the side of the keycap due to the keytop being tilted.
|
||||
// necessary for calculating flat sided keycaps
|
||||
@@ -2073,12 +2077,12 @@ module ISO_enter_shape(size, delta, progress){
|
||||
}
|
||||
|
||||
function iso_enter_vertices(size, delta, progress, thickness_difference) = [
|
||||
[ 0-delta.x/2 * progress - thickness_difference/8, 0 - delta.y / 2 * progress - thickness_difference/8], // top right
|
||||
[ 0-delta.x/2 * progress - thickness_difference/8, -size[1] + delta.y / 2 * progress + thickness_difference/8], // bottom right
|
||||
[-size[0] * width_ratio + delta.x/2 * progress + thickness_difference/8, -size[1] + delta.y / 2 * progress + thickness_difference/8], // bottom left
|
||||
[-size[0] * width_ratio + delta.x/2 * progress + thickness_difference/8,-size[1] * height_ratio + delta.y / 2 * progress + thickness_difference/2], // inner middle point
|
||||
[ -size[0] + delta.x/2 * progress + thickness_difference/8,-size[1] * height_ratio + delta.y / 2 * progress + thickness_difference/2], // outer middle point
|
||||
[ -size[0] + delta.x/2 * progress + thickness_difference/8, 0 - delta.y / 2 * progress - thickness_difference/8] // top left
|
||||
[ 0-delta.x/2 * progress - thickness_difference/2, 0 - delta.y / 2 * progress - thickness_difference/2], // top right
|
||||
[ 0-delta.x/2 * progress - thickness_difference/2, -size[1] + delta.y / 2 * progress + thickness_difference/2], // bottom right
|
||||
[-size[0] * width_ratio + delta.x/2 * progress + thickness_difference/2, -size[1] + delta.y / 2 * progress + thickness_difference/2], // bottom left
|
||||
[-size[0] * width_ratio + delta.x/2 * progress + thickness_difference/2,-size[1] * height_ratio + delta.y / 2 * progress + thickness_difference/2], // inner middle point
|
||||
[ -size[0] + delta.x/2 * progress + thickness_difference/2,-size[1] * height_ratio + delta.y / 2 * progress + thickness_difference/2], // outer middle point
|
||||
[ -size[0] + delta.x/2 * progress + thickness_difference/2, 0 - delta.y / 2 * progress - thickness_difference/2] // top left
|
||||
] + [
|
||||
[(size[0] * width_ratio)/2, size[1]/2 ],
|
||||
[(size[0] * width_ratio)/2, size[1]/2 ],
|
||||
@@ -2254,7 +2258,7 @@ function top_total_key_height() = $bottom_key_height + ($unit * ($key_height - 1
|
||||
|
||||
function side_tilt(column) = asin($unit * column / $double_sculpt_radius);
|
||||
// tan of 0 is 0, division by 0 is nan, so we have to guard
|
||||
function extra_side_tilt_height(column) = side_tilt(column) ? ($double_sculpt_radius - ($unit * abs(column)) / tan(abs(side_tilt(column)))) : 0;
|
||||
function extra_side_tilt_height(column) = side_tilt(column) ? ($double_sculpt_radius - (unit * abs(column)) / tan(abs(side_tilt(column)))) : 0;
|
||||
|
||||
// (I think) extra length of the side of the keycap due to the keytop being tilted.
|
||||
// necessary for calculating flat sided keycaps
|
||||
@@ -3078,7 +3082,7 @@ function top_total_key_height() = $bottom_key_height + ($unit * ($key_height - 1
|
||||
|
||||
function side_tilt(column) = asin($unit * column / $double_sculpt_radius);
|
||||
// tan of 0 is 0, division by 0 is nan, so we have to guard
|
||||
function extra_side_tilt_height(column) = side_tilt(column) ? ($double_sculpt_radius - ($unit * abs(column)) / tan(abs(side_tilt(column)))) : 0;
|
||||
function extra_side_tilt_height(column) = side_tilt(column) ? ($double_sculpt_radius - (unit * abs(column)) / tan(abs(side_tilt(column)))) : 0;
|
||||
|
||||
// (I think) extra length of the side of the keycap due to the keytop being tilted.
|
||||
// necessary for calculating flat sided keycaps
|
||||
@@ -3268,7 +3272,7 @@ function top_total_key_height() = $bottom_key_height + ($unit * ($key_height - 1
|
||||
|
||||
function side_tilt(column) = asin($unit * column / $double_sculpt_radius);
|
||||
// tan of 0 is 0, division by 0 is nan, so we have to guard
|
||||
function extra_side_tilt_height(column) = side_tilt(column) ? ($double_sculpt_radius - ($unit * abs(column)) / tan(abs(side_tilt(column)))) : 0;
|
||||
function extra_side_tilt_height(column) = side_tilt(column) ? ($double_sculpt_radius - (unit * abs(column)) / tan(abs(side_tilt(column)))) : 0;
|
||||
|
||||
// (I think) extra length of the side of the keycap due to the keytop being tilted.
|
||||
// necessary for calculating flat sided keycaps
|
||||
@@ -3379,7 +3383,7 @@ function top_total_key_height() = $bottom_key_height + ($unit * ($key_height - 1
|
||||
|
||||
function side_tilt(column) = asin($unit * column / $double_sculpt_radius);
|
||||
// tan of 0 is 0, division by 0 is nan, so we have to guard
|
||||
function extra_side_tilt_height(column) = side_tilt(column) ? ($double_sculpt_radius - ($unit * abs(column)) / tan(abs(side_tilt(column)))) : 0;
|
||||
function extra_side_tilt_height(column) = side_tilt(column) ? ($double_sculpt_radius - (unit * abs(column)) / tan(abs(side_tilt(column)))) : 0;
|
||||
|
||||
// (I think) extra length of the side of the keycap due to the keytop being tilted.
|
||||
// necessary for calculating flat sided keycaps
|
||||
@@ -3454,7 +3458,7 @@ function top_total_key_height() = $bottom_key_height + ($unit * ($key_height - 1
|
||||
|
||||
function side_tilt(column) = asin($unit * column / $double_sculpt_radius);
|
||||
// tan of 0 is 0, division by 0 is nan, so we have to guard
|
||||
function extra_side_tilt_height(column) = side_tilt(column) ? ($double_sculpt_radius - ($unit * abs(column)) / tan(abs(side_tilt(column)))) : 0;
|
||||
function extra_side_tilt_height(column) = side_tilt(column) ? ($double_sculpt_radius - (unit * abs(column)) / tan(abs(side_tilt(column)))) : 0;
|
||||
|
||||
// (I think) extra length of the side of the keycap due to the keytop being tilted.
|
||||
// necessary for calculating flat sided keycaps
|
||||
@@ -3534,7 +3538,7 @@ module rounded_cherry_stem(depth, slop, throw) {
|
||||
|
||||
// inside cross
|
||||
// translation purely for aesthetic purposes, to get rid of that awful lattice
|
||||
inside_cherry_cross($stem_inner_slop);
|
||||
inside_cherry_cross(slop);
|
||||
}
|
||||
}
|
||||
// a safe theoretical distance between two vertices such that they don't collapse. hard to use
|
||||
@@ -3575,7 +3579,7 @@ function top_total_key_height() = $bottom_key_height + ($unit * ($key_height - 1
|
||||
|
||||
function side_tilt(column) = asin($unit * column / $double_sculpt_radius);
|
||||
// tan of 0 is 0, division by 0 is nan, so we have to guard
|
||||
function extra_side_tilt_height(column) = side_tilt(column) ? ($double_sculpt_radius - ($unit * abs(column)) / tan(abs(side_tilt(column)))) : 0;
|
||||
function extra_side_tilt_height(column) = side_tilt(column) ? ($double_sculpt_radius - (unit * abs(column)) / tan(abs(side_tilt(column)))) : 0;
|
||||
|
||||
// (I think) extra length of the side of the keycap due to the keytop being tilted.
|
||||
// necessary for calculating flat sided keycaps
|
||||
@@ -3650,7 +3654,7 @@ function top_total_key_height() = $bottom_key_height + ($unit * ($key_height - 1
|
||||
|
||||
function side_tilt(column) = asin($unit * column / $double_sculpt_radius);
|
||||
// tan of 0 is 0, division by 0 is nan, so we have to guard
|
||||
function extra_side_tilt_height(column) = side_tilt(column) ? ($double_sculpt_radius - ($unit * abs(column)) / tan(abs(side_tilt(column)))) : 0;
|
||||
function extra_side_tilt_height(column) = side_tilt(column) ? ($double_sculpt_radius - (unit * abs(column)) / tan(abs(side_tilt(column)))) : 0;
|
||||
|
||||
// (I think) extra length of the side of the keycap due to the keytop being tilted.
|
||||
// necessary for calculating flat sided keycaps
|
||||
@@ -3734,7 +3738,7 @@ module box_cherry_stem(depth, slop, throw) {
|
||||
}
|
||||
|
||||
// inside cross
|
||||
inside_cherry_cross($stem_inner_slop);
|
||||
inside_cherry_cross(slop);
|
||||
}
|
||||
}
|
||||
module alps_stem(depth, slop, throw){
|
||||
@@ -3789,7 +3793,7 @@ function top_total_key_height() = $bottom_key_height + ($unit * ($key_height - 1
|
||||
|
||||
function side_tilt(column) = asin($unit * column / $double_sculpt_radius);
|
||||
// tan of 0 is 0, division by 0 is nan, so we have to guard
|
||||
function extra_side_tilt_height(column) = side_tilt(column) ? ($double_sculpt_radius - ($unit * abs(column)) / tan(abs(side_tilt(column)))) : 0;
|
||||
function extra_side_tilt_height(column) = side_tilt(column) ? ($double_sculpt_radius - (unit * abs(column)) / tan(abs(side_tilt(column)))) : 0;
|
||||
|
||||
// (I think) extra length of the side of the keycap due to the keytop being tilted.
|
||||
// necessary for calculating flat sided keycaps
|
||||
@@ -3934,7 +3938,7 @@ function top_total_key_height() = $bottom_key_height + ($unit * ($key_height - 1
|
||||
|
||||
function side_tilt(column) = asin($unit * column / $double_sculpt_radius);
|
||||
// tan of 0 is 0, division by 0 is nan, so we have to guard
|
||||
function extra_side_tilt_height(column) = side_tilt(column) ? ($double_sculpt_radius - ($unit * abs(column)) / tan(abs(side_tilt(column)))) : 0;
|
||||
function extra_side_tilt_height(column) = side_tilt(column) ? ($double_sculpt_radius - (unit * abs(column)) / tan(abs(side_tilt(column)))) : 0;
|
||||
|
||||
// (I think) extra length of the side of the keycap due to the keytop being tilted.
|
||||
// necessary for calculating flat sided keycaps
|
||||
@@ -4009,7 +4013,7 @@ function top_total_key_height() = $bottom_key_height + ($unit * ($key_height - 1
|
||||
|
||||
function side_tilt(column) = asin($unit * column / $double_sculpt_radius);
|
||||
// tan of 0 is 0, division by 0 is nan, so we have to guard
|
||||
function extra_side_tilt_height(column) = side_tilt(column) ? ($double_sculpt_radius - ($unit * abs(column)) / tan(abs(side_tilt(column)))) : 0;
|
||||
function extra_side_tilt_height(column) = side_tilt(column) ? ($double_sculpt_radius - (unit * abs(column)) / tan(abs(side_tilt(column)))) : 0;
|
||||
|
||||
// (I think) extra length of the side of the keycap due to the keytop being tilted.
|
||||
// necessary for calculating flat sided keycaps
|
||||
@@ -4098,12 +4102,12 @@ module brim_support(stem_type, stem_support_height, slop) {
|
||||
}
|
||||
}
|
||||
|
||||
inside_cherry_cross($stem_inner_slop);
|
||||
inside_cherry_cross(slop);
|
||||
}
|
||||
} else if (stem_type == "rounded_cherry") {
|
||||
difference() {
|
||||
cylinder(d=$rounded_cherry_stem_d * 2, h=stem_support_height);
|
||||
inside_cherry_cross($stem_inner_slop);
|
||||
inside_cherry_cross(slop);
|
||||
}
|
||||
} else if (stem_type == "box_cherry") {
|
||||
difference() {
|
||||
@@ -4113,7 +4117,7 @@ module brim_support(stem_type, stem_support_height, slop) {
|
||||
}
|
||||
}
|
||||
|
||||
inside_cherry_cross($stem_inner_slop);
|
||||
inside_cherry_cross(slop);
|
||||
}
|
||||
} else if (stem_type == "cherry_stabilizer") {
|
||||
difference() {
|
||||
@@ -4123,7 +4127,7 @@ module brim_support(stem_type, stem_support_height, slop) {
|
||||
}
|
||||
}
|
||||
|
||||
inside_cherry_cross($stem_inner_slop);
|
||||
inside_cherry_cross(slop);
|
||||
}
|
||||
} else if(stem_type == "choc") {
|
||||
translate([-5.7/2,0,0]) linear_extrude(height=stem_support_height) {
|
||||
@@ -4177,7 +4181,7 @@ function top_total_key_height() = $bottom_key_height + ($unit * ($key_height - 1
|
||||
|
||||
function side_tilt(column) = asin($unit * column / $double_sculpt_radius);
|
||||
// tan of 0 is 0, division by 0 is nan, so we have to guard
|
||||
function extra_side_tilt_height(column) = side_tilt(column) ? ($double_sculpt_radius - ($unit * abs(column)) / tan(abs(side_tilt(column)))) : 0;
|
||||
function extra_side_tilt_height(column) = side_tilt(column) ? ($double_sculpt_radius - (unit * abs(column)) / tan(abs(side_tilt(column)))) : 0;
|
||||
|
||||
// (I think) extra length of the side of the keycap due to the keytop being tilted.
|
||||
// necessary for calculating flat sided keycaps
|
||||
@@ -4252,7 +4256,7 @@ function top_total_key_height() = $bottom_key_height + ($unit * ($key_height - 1
|
||||
|
||||
function side_tilt(column) = asin($unit * column / $double_sculpt_radius);
|
||||
// tan of 0 is 0, division by 0 is nan, so we have to guard
|
||||
function extra_side_tilt_height(column) = side_tilt(column) ? ($double_sculpt_radius - ($unit * abs(column)) / tan(abs(side_tilt(column)))) : 0;
|
||||
function extra_side_tilt_height(column) = side_tilt(column) ? ($double_sculpt_radius - (unit * abs(column)) / tan(abs(side_tilt(column)))) : 0;
|
||||
|
||||
// (I think) extra length of the side of the keycap due to the keytop being tilted.
|
||||
// necessary for calculating flat sided keycaps
|
||||
@@ -4326,20 +4330,17 @@ 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()*2, 0.5, $stem_support_height], center = true);
|
||||
cube([total_key_width(), 0.5, $stem_support_height], center = true);
|
||||
}
|
||||
}
|
||||
|
||||
translate([0,0,$stem_support_height / 2]) {
|
||||
cube([
|
||||
1,
|
||||
total_key_height()*2,
|
||||
total_key_height(),
|
||||
$stem_support_height
|
||||
],
|
||||
center = true);
|
||||
@@ -4347,13 +4348,16 @@ 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()*2,
|
||||
total_key_width() + extra_width*2,
|
||||
0.5,
|
||||
$stem_support_height
|
||||
], center = true);
|
||||
@@ -4365,14 +4369,14 @@ module tines_support(stem_type, stem_support_height, slop) {
|
||||
translate([x,0,$stem_support_height / 2]) {
|
||||
cube([
|
||||
0.5,
|
||||
total_key_height()*2, // this is to extend past
|
||||
total_key_height() + extra_height*2, // this is to extend past
|
||||
$stem_support_height
|
||||
], center = true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inside_cherry_cross($stem_inner_slop);
|
||||
inside_cherry_cross(slop);
|
||||
}
|
||||
} else if (stem_type == "cherry_stabilizer") {
|
||||
difference () {
|
||||
@@ -4380,7 +4384,7 @@ module tines_support(stem_type, stem_support_height, slop) {
|
||||
translate([x,0,$stem_support_height / 2]) {
|
||||
cube([
|
||||
1,
|
||||
total_key_height()*2,
|
||||
total_key_height($wall_thickness),
|
||||
$stem_support_height
|
||||
], center = true);
|
||||
}
|
||||
@@ -4392,20 +4396,20 @@ module tines_support(stem_type, stem_support_height, slop) {
|
||||
difference () {
|
||||
centered_tines(stem_support_height);
|
||||
|
||||
inside_cherry_cross($stem_inner_slop);
|
||||
inside_cherry_cross(slop);
|
||||
}
|
||||
} else if (stem_type == "rounded_cherry") {
|
||||
difference () {
|
||||
centered_tines(stem_support_height);
|
||||
|
||||
inside_cherry_cross($stem_inner_slop);
|
||||
inside_cherry_cross(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(), 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); */
|
||||
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); */
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4658,7 +4662,7 @@ function top_total_key_height() = $bottom_key_height + ($unit * ($key_height - 1
|
||||
|
||||
function side_tilt(column) = asin($unit * column / $double_sculpt_radius);
|
||||
// tan of 0 is 0, division by 0 is nan, so we have to guard
|
||||
function extra_side_tilt_height(column) = side_tilt(column) ? ($double_sculpt_radius - ($unit * abs(column)) / tan(abs(side_tilt(column)))) : 0;
|
||||
function extra_side_tilt_height(column) = side_tilt(column) ? ($double_sculpt_radius - (unit * abs(column)) / tan(abs(side_tilt(column)))) : 0;
|
||||
|
||||
// (I think) extra length of the side of the keycap due to the keytop being tilted.
|
||||
// necessary for calculating flat sided keycaps
|
||||
@@ -4848,7 +4852,7 @@ function top_total_key_height() = $bottom_key_height + ($unit * ($key_height - 1
|
||||
|
||||
function side_tilt(column) = asin($unit * column / $double_sculpt_radius);
|
||||
// tan of 0 is 0, division by 0 is nan, so we have to guard
|
||||
function extra_side_tilt_height(column) = side_tilt(column) ? ($double_sculpt_radius - ($unit * abs(column)) / tan(abs(side_tilt(column)))) : 0;
|
||||
function extra_side_tilt_height(column) = side_tilt(column) ? ($double_sculpt_radius - (unit * abs(column)) / tan(abs(side_tilt(column)))) : 0;
|
||||
|
||||
// (I think) extra length of the side of the keycap due to the keytop being tilted.
|
||||
// necessary for calculating flat sided keycaps
|
||||
@@ -6086,6 +6090,7 @@ module shape(thickness_difference, depth_difference=0){
|
||||
}
|
||||
}
|
||||
|
||||
// Not currently used due to CGAL errors. Rounds the shape via minkowski
|
||||
module rounded_shape() {
|
||||
color($primary_color) minkowski(){
|
||||
// half minkowski in the z direction
|
||||
@@ -6174,9 +6179,9 @@ module top_placement(depth_difference=0) {
|
||||
top_tilt_by_height = -$top_tilt / $key_height;
|
||||
top_tilt_y_by_length = $double_sculpted ? (-$top_tilt_y / $key_length) : 0;
|
||||
|
||||
// minkowski_height = $rounded_key ? $minkowski_radius : 0;
|
||||
minkowski_height = $rounded_key ? $minkowski_radius : 0;
|
||||
|
||||
translate([$top_skew_x + $dish_skew_x, $top_skew + $dish_skew_y, $total_depth - depth_difference]){
|
||||
translate([$top_skew_x + $dish_skew_x, $top_skew + $dish_skew_y, $total_depth - depth_difference + minkowski_height/2]){
|
||||
rotate([top_tilt_by_height, top_tilt_y_by_length,0]){
|
||||
children();
|
||||
}
|
||||
@@ -6296,9 +6301,7 @@ module outer_total_shape(inset=false) {
|
||||
// takes all the bits and glues them together. requires configuration with special variables.
|
||||
module key(inset=false) {
|
||||
difference(){
|
||||
outer_total_shape(inset) {
|
||||
children();
|
||||
};
|
||||
outer_total_shape(inset);
|
||||
|
||||
if ($inner_shape_type != "disable") {
|
||||
translate([0,0,-SMALLEST_POSSIBLE]) {
|
||||
@@ -6401,6 +6404,10 @@ $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'
|
||||
|
||||
@@ -17,4 +17,4 @@ dcs_row(5) legend("⇪", size=9) key();
|
||||
} */
|
||||
|
||||
// example layout
|
||||
/* preonic_default("dcs") key(); */
|
||||
/* preonic_default("dcs"); */
|
||||
@@ -33,7 +33,7 @@ function top_total_key_height() = $bottom_key_height + ($unit * ($key_height - 1
|
||||
|
||||
function side_tilt(column) = asin($unit * column / $double_sculpt_radius);
|
||||
// tan of 0 is 0, division by 0 is nan, so we have to guard
|
||||
function extra_side_tilt_height(column) = side_tilt(column) ? ($double_sculpt_radius - ($unit * abs(column)) / tan(abs(side_tilt(column)))) : 0;
|
||||
function extra_side_tilt_height(column) = side_tilt(column) ? ($double_sculpt_radius - (unit * abs(column)) / tan(abs(side_tilt(column)))) : 0;
|
||||
|
||||
// (I think) extra length of the side of the keycap due to the keytop being tilted.
|
||||
// necessary for calculating flat sided keycaps
|
||||
|
||||
@@ -24,6 +24,7 @@ module shape(thickness_difference, depth_difference=0){
|
||||
}
|
||||
}
|
||||
|
||||
// Not currently used due to CGAL errors. Rounds the shape via minkowski
|
||||
module rounded_shape() {
|
||||
color($primary_color) minkowski(){
|
||||
// half minkowski in the z direction
|
||||
@@ -112,9 +113,9 @@ module top_placement(depth_difference=0) {
|
||||
top_tilt_by_height = -$top_tilt / $key_height;
|
||||
top_tilt_y_by_length = $double_sculpted ? (-$top_tilt_y / $key_length) : 0;
|
||||
|
||||
// minkowski_height = $rounded_key ? $minkowski_radius : 0;
|
||||
minkowski_height = $rounded_key ? $minkowski_radius : 0;
|
||||
|
||||
translate([$top_skew_x + $dish_skew_x, $top_skew + $dish_skew_y, $total_depth - depth_difference]){
|
||||
translate([$top_skew_x + $dish_skew_x, $top_skew + $dish_skew_y, $total_depth - depth_difference + minkowski_height/2]){
|
||||
rotate([top_tilt_by_height, top_tilt_y_by_length,0]){
|
||||
children();
|
||||
}
|
||||
@@ -234,9 +235,7 @@ module outer_total_shape(inset=false) {
|
||||
// takes all the bits and glues them together. requires configuration with special variables.
|
||||
module key(inset=false) {
|
||||
difference(){
|
||||
outer_total_shape(inset) {
|
||||
children();
|
||||
};
|
||||
outer_total_shape(inset);
|
||||
|
||||
if ($inner_shape_type != "disable") {
|
||||
translate([0,0,-SMALLEST_POSSIBLE]) {
|
||||
|
||||
@@ -79,6 +79,10 @@ $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'
|
||||
|
||||
@@ -38,12 +38,12 @@ module ISO_enter_shape(size, delta, progress){
|
||||
}
|
||||
|
||||
function iso_enter_vertices(size, delta, progress, thickness_difference) = [
|
||||
[ 0-delta.x/2 * progress - thickness_difference/8, 0 - delta.y / 2 * progress - thickness_difference/8], // top right
|
||||
[ 0-delta.x/2 * progress - thickness_difference/8, -size[1] + delta.y / 2 * progress + thickness_difference/8], // bottom right
|
||||
[-size[0] * width_ratio + delta.x/2 * progress + thickness_difference/8, -size[1] + delta.y / 2 * progress + thickness_difference/8], // bottom left
|
||||
[-size[0] * width_ratio + delta.x/2 * progress + thickness_difference/8,-size[1] * height_ratio + delta.y / 2 * progress + thickness_difference/2], // inner middle point
|
||||
[ -size[0] + delta.x/2 * progress + thickness_difference/8,-size[1] * height_ratio + delta.y / 2 * progress + thickness_difference/2], // outer middle point
|
||||
[ -size[0] + delta.x/2 * progress + thickness_difference/8, 0 - delta.y / 2 * progress - thickness_difference/8] // top left
|
||||
[ 0-delta.x/2 * progress - thickness_difference/2, 0 - delta.y / 2 * progress - thickness_difference/2], // top right
|
||||
[ 0-delta.x/2 * progress - thickness_difference/2, -size[1] + delta.y / 2 * progress + thickness_difference/2], // bottom right
|
||||
[-size[0] * width_ratio + delta.x/2 * progress + thickness_difference/2, -size[1] + delta.y / 2 * progress + thickness_difference/2], // bottom left
|
||||
[-size[0] * width_ratio + delta.x/2 * progress + thickness_difference/2,-size[1] * height_ratio + delta.y / 2 * progress + thickness_difference/2], // inner middle point
|
||||
[ -size[0] + delta.x/2 * progress + thickness_difference/2,-size[1] * height_ratio + delta.y / 2 * progress + thickness_difference/2], // outer middle point
|
||||
[ -size[0] + delta.x/2 * progress + thickness_difference/2, 0 - delta.y / 2 * progress - thickness_difference/2] // top left
|
||||
] + [
|
||||
[(size[0] * width_ratio)/2, size[1]/2 ],
|
||||
[(size[0] * width_ratio)/2, size[1]/2 ],
|
||||
|
||||
@@ -16,12 +16,12 @@ module brim_support(stem_type, stem_support_height, slop) {
|
||||
}
|
||||
}
|
||||
|
||||
inside_cherry_cross($stem_inner_slop);
|
||||
inside_cherry_cross(slop);
|
||||
}
|
||||
} else if (stem_type == "rounded_cherry") {
|
||||
difference() {
|
||||
cylinder(d=$rounded_cherry_stem_d * 2, h=stem_support_height);
|
||||
inside_cherry_cross($stem_inner_slop);
|
||||
inside_cherry_cross(slop);
|
||||
}
|
||||
} else if (stem_type == "box_cherry") {
|
||||
difference() {
|
||||
@@ -31,7 +31,7 @@ module brim_support(stem_type, stem_support_height, slop) {
|
||||
}
|
||||
}
|
||||
|
||||
inside_cherry_cross($stem_inner_slop);
|
||||
inside_cherry_cross(slop);
|
||||
}
|
||||
} else if (stem_type == "cherry_stabilizer") {
|
||||
difference() {
|
||||
@@ -41,7 +41,7 @@ module brim_support(stem_type, stem_support_height, slop) {
|
||||
}
|
||||
}
|
||||
|
||||
inside_cherry_cross($stem_inner_slop);
|
||||
inside_cherry_cross(slop);
|
||||
}
|
||||
} else if(stem_type == "choc") {
|
||||
translate([-5.7/2,0,0]) linear_extrude(height=stem_support_height) {
|
||||
|
||||
@@ -1,20 +1,17 @@
|
||||
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()*2, 0.5, $stem_support_height], center = true);
|
||||
cube([total_key_width(), 0.5, $stem_support_height], center = true);
|
||||
}
|
||||
}
|
||||
|
||||
translate([0,0,$stem_support_height / 2]) {
|
||||
cube([
|
||||
1,
|
||||
total_key_height()*2,
|
||||
total_key_height(),
|
||||
$stem_support_height
|
||||
],
|
||||
center = true);
|
||||
@@ -22,13 +19,16 @@ 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()*2,
|
||||
total_key_width() + extra_width*2,
|
||||
0.5,
|
||||
$stem_support_height
|
||||
], center = true);
|
||||
@@ -40,14 +40,14 @@ module tines_support(stem_type, stem_support_height, slop) {
|
||||
translate([x,0,$stem_support_height / 2]) {
|
||||
cube([
|
||||
0.5,
|
||||
total_key_height()*2, // this is to extend past
|
||||
total_key_height() + extra_height*2, // this is to extend past
|
||||
$stem_support_height
|
||||
], center = true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inside_cherry_cross($stem_inner_slop);
|
||||
inside_cherry_cross(slop);
|
||||
}
|
||||
} else if (stem_type == "cherry_stabilizer") {
|
||||
difference () {
|
||||
@@ -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()*2,
|
||||
total_key_height($wall_thickness),
|
||||
$stem_support_height
|
||||
], center = true);
|
||||
}
|
||||
@@ -67,19 +67,19 @@ module tines_support(stem_type, stem_support_height, slop) {
|
||||
difference () {
|
||||
centered_tines(stem_support_height);
|
||||
|
||||
inside_cherry_cross($stem_inner_slop);
|
||||
inside_cherry_cross(slop);
|
||||
}
|
||||
} else if (stem_type == "rounded_cherry") {
|
||||
difference () {
|
||||
centered_tines(stem_support_height);
|
||||
|
||||
inside_cherry_cross($stem_inner_slop);
|
||||
inside_cherry_cross(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(), 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); */
|
||||
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); */
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,6 @@ module box_cherry_stem(depth, slop, throw) {
|
||||
}
|
||||
|
||||
// inside cross
|
||||
inside_cherry_cross($stem_inner_slop);
|
||||
inside_cherry_cross(slop);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,6 @@ module rounded_cherry_stem(depth, slop, throw) {
|
||||
|
||||
// inside cross
|
||||
// translation purely for aesthetic purposes, to get rid of that awful lattice
|
||||
inside_cherry_cross($stem_inner_slop);
|
||||
inside_cherry_cross(slop);
|
||||
}
|
||||
}
|
||||
|
||||
35
yarn.lock
35
yarn.lock
@@ -445,12 +445,12 @@ copy-descriptor@^0.1.0:
|
||||
integrity sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=
|
||||
|
||||
copy-props@^2.0.1:
|
||||
version "2.0.5"
|
||||
resolved "https://registry.yarnpkg.com/copy-props/-/copy-props-2.0.5.tgz#03cf9ae328d4ebb36f8f1d804448a6af9ee3f2d2"
|
||||
integrity sha512-XBlx8HSqrT0ObQwmSzM7WE5k8FxTV75h1DX1Z3n6NhQ/UYYAvInWYmG06vFt7hQZArE2fuO62aihiWIVQwh1sw==
|
||||
version "2.0.4"
|
||||
resolved "https://registry.yarnpkg.com/copy-props/-/copy-props-2.0.4.tgz#93bb1cadfafd31da5bb8a9d4b41f471ec3a72dfe"
|
||||
integrity sha512-7cjuUME+p+S3HZlbllgsn2CDwS+5eCCX16qBgNC4jgSTf49qR1VKy/Zhl400m0IQXl/bPGEVqncgUUMjrr4s8A==
|
||||
dependencies:
|
||||
each-props "^1.3.2"
|
||||
is-plain-object "^5.0.0"
|
||||
each-props "^1.3.0"
|
||||
is-plain-object "^2.0.1"
|
||||
|
||||
core-util-is@~1.0.0:
|
||||
version "1.0.2"
|
||||
@@ -538,7 +538,7 @@ duplexify@^3.6.0:
|
||||
readable-stream "^2.0.0"
|
||||
stream-shift "^1.0.0"
|
||||
|
||||
each-props@^1.3.2:
|
||||
each-props@^1.3.0:
|
||||
version "1.3.2"
|
||||
resolved "https://registry.yarnpkg.com/each-props/-/each-props-1.3.2.tgz#ea45a414d16dd5cfa419b1a81720d5ca06892333"
|
||||
integrity sha512-vV0Hem3zAGkJAyU7JSjixeU66rwdynTAa1vofCrSA5fEln+m67Az9CcnkVD776/fsN/UjIWmBDoNRS6t6G9RfA==
|
||||
@@ -1013,9 +1013,9 @@ homedir-polyfill@^1.0.1:
|
||||
parse-passwd "^1.0.0"
|
||||
|
||||
hosted-git-info@^2.1.4:
|
||||
version "2.8.9"
|
||||
resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.8.9.tgz#dffc0bf9a21c02209090f2aa69429e1414daf3f9"
|
||||
integrity sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==
|
||||
version "2.8.8"
|
||||
resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.8.8.tgz#7539bd4bc1e0e0a895815a2e0262420b12858488"
|
||||
integrity sha512-f/wzC2QaWBs7t9IYqB4T3sR1xviIViXJRJTWBlx2Gf3g0Xi5vI7Yy4koXQ1c9OYDGHN9sBy1DQ2AB8fqZBWhUg==
|
||||
|
||||
inflight@^1.0.4:
|
||||
version "1.0.6"
|
||||
@@ -1178,11 +1178,6 @@ is-plain-object@^2.0.1, is-plain-object@^2.0.3, is-plain-object@^2.0.4:
|
||||
dependencies:
|
||||
isobject "^3.0.1"
|
||||
|
||||
is-plain-object@^5.0.0:
|
||||
version "5.0.0"
|
||||
resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-5.0.0.tgz#4427f50ab3429e9025ea7d52e9043a9ef4159344"
|
||||
integrity sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==
|
||||
|
||||
is-relative@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/is-relative/-/is-relative-1.0.0.tgz#a1bb6935ce8c5dba1e8b9754b9b2dcc020e2260d"
|
||||
@@ -1629,9 +1624,9 @@ path-is-absolute@^1.0.0:
|
||||
integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18=
|
||||
|
||||
path-parse@^1.0.6:
|
||||
version "1.0.7"
|
||||
resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735"
|
||||
integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==
|
||||
version "1.0.6"
|
||||
resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c"
|
||||
integrity sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==
|
||||
|
||||
path-root-regex@^0.1.0:
|
||||
version "0.1.2"
|
||||
@@ -2353,9 +2348,9 @@ xtend@~4.0.0, xtend@~4.0.1:
|
||||
integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==
|
||||
|
||||
y18n@^3.2.1:
|
||||
version "3.2.2"
|
||||
resolved "https://registry.yarnpkg.com/y18n/-/y18n-3.2.2.tgz#85c901bd6470ce71fc4bb723ad209b70f7f28696"
|
||||
integrity sha512-uGZHXkHnhF0XeeAPgnKfPv1bgKAYyVvmNL1xlKsPYZPaIHxGti2hHqvOCQv71XMsLxu1QjergkqogUnms5D3YQ==
|
||||
version "3.2.1"
|
||||
resolved "https://registry.yarnpkg.com/y18n/-/y18n-3.2.1.tgz#6d15fba884c08679c0d77e88e7759e811e07fa41"
|
||||
integrity sha1-bRX7qITAhnnA136I53WegR4H+kE=
|
||||
|
||||
yargs-parser@^5.0.0:
|
||||
version "5.0.1"
|
||||
|
||||
Reference in New Issue
Block a user