finalize keysets.scad (just 60%, the other profiles will take too much work for negligent gain since who prints an 86 key keyset out in one go) and add top_of_key to allow for children of key() to be rendered smack in the middle of the keytop

This commit is contained in:
Bob - Home - Windows 2017-10-17 00:50:48 -04:00
parent d9747e76b5
commit 16f97911ae
3 changed files with 26 additions and 18 deletions

View File

@ -186,12 +186,21 @@ module dished(depth_difference, inverted = false) {
} }
} }
module keytext() { // puts it's children at the center of the dishing on the key. this DOES rotate them though, it's not straight up
module top_of_key(){
extra_dish_depth = ($dish_type == "no dish") ? 0 : $dish_depth; extra_dish_depth = ($dish_type == "no dish") ? 0 : $dish_depth;
translate([$dish_skew_x, $top_skew + $dish_skew_y, $total_depth - extra_dish_depth]){
rotate([-$top_tilt,0,0]){
children();
}
}
}
module keytext() {
extra_inset_depth = ($inset_text) ? keytop_thickness/4 : 0; extra_inset_depth = ($inset_text) ? keytop_thickness/4 : 0;
translate([$dish_skew_x, $top_skew + $dish_skew_y, $total_depth - extra_dish_depth - extra_inset_depth]){ translate([0, 0, -extra_inset_depth]){
rotate([-$top_tilt,0,0]){ top_of_key(){
linear_extrude(height=$dish_depth){ linear_extrude(height=$dish_depth){
text(text=$text, font=font, size=font_size, halign="center", valign="center"); text(text=$text, font=font, size=font_size, halign="center", valign="center");
} }
@ -252,6 +261,9 @@ module key() {
if($stem_profile != "blank") connectors($stem_profile); if($stem_profile != "blank") connectors($stem_profile);
if(!$inset_text) keytext(); if(!$inset_text) keytext();
clearance_check(); clearance_check();
top_of_key() {
children();
}
} }
if ($inset_text) keytext(); if ($inset_text) keytext();
} }

View File

@ -1,17 +1,15 @@
// the point of this file is to be a sort of DSL for constructing keycaps. // the point of this file is to be a sort of DSL for constructing keycaps.
// when you create a method chain you are just changing the parameters // when you create a method chain you are just changing the parameters
// key.scad uses, it doesn't generate anything itself until the end. This // key.scad uses, it doesn't generate anything itself until the end. This
// makes it remain easy to use key.scad like before (except without key profiles) // lets it remain easy to use key.scad like before (except without key profiles)
// without having to rely on this file. Unfortunately that means setting tons of // without having to rely on this file. Unfortunately that means setting tons of
// special variables, but that's a limitation of SCAD we have to work around // special variables, but that's a limitation of SCAD we have to work around
/* TODO: /* TODO:
* can now measure keycaps very accurately. need to redo measurements: [x] SA [ ] DCS [X] DSA [X] OEM? * can now measure keycaps very accurately. need to redo measurements: [x] SA [ ] DCS [X] DSA [X] OEM?
* make OEM profile from my WASD keyset * Add inset stem to all profiles that need it. [x] OEM [ ] DCS?
* Pregenerated keysets for DCS (rounded tops too intense) WITH rounded spacebar [ ] 60% [ ] TKL [ ] full
* Add inset stem to all profiles that need it (DCS?)
* generate dishes via math? kind of hard
* customizer version where everything is copy/pasted in. needs to be last. * customizer version where everything is copy/pasted in. needs to be last.
* generate dishes via math? kind of hard, maybe later
*/ */
use <key.scad> use <key.scad>
@ -414,8 +412,9 @@ module legend(text, inset=false) {
children(); children();
} }
rows = [4,3,2,1,5]; /*rows = [4,3,2,1,5];
translate_u(0, 0) oem_row(rows[0]) cherry() key(); translate_u(0, 0) oem_row(1) cherry() key() {
translate_u(0, 1) oem_row(rows[1]) cherry() key(); cube(2, center=true);
};*/

View File

@ -15,18 +15,15 @@ function sum(list, x=0) =
x + list[0] : x + list[0] :
sum([for (x = [1: len(list) - 1]) list[x]], x+list[0]); sum([for (x = [1: len(list) - 1]) list[x]], x+list[0]);
echo(sum([1,2,3])); for (row = [0:len(60_percent)-1]){
for(column = [0:len(60_percent[row])-1]) {
for (row = [0:len(60_percent)]){
for(column = [0:len(60_percent[row])]) {
columnDist = sum([for (x = [0 : column]) 60_percent[row][x]]); columnDist = sum([for (x = [0 : column]) 60_percent[row][x]]);
a = 60_percent[row][column]; a = 60_percent[row][column];
translate_u(columnDist - (a/2), -row) dishless() dcs_row((row+4) % 5 + 1) u(a) blank(){ translate_u(columnDist - (a/2), -row) dishless() dcs_row((row+4) % 5 + 1) u(a) cherry() {
if (a != 6.25) { if (a != 6.25) {
key(); key();
} else { } else {
$dish_type = 2; spacebar() key();
key();
} }
} }
} }