Layout updates

rediscovered my old keysets file, adapted the functionality to make a flexible base layout tool.

also tweaked double sculpting to generically sculpt to both hands. it works, but it still needs more refinement, and the best layouts are going to be hand-generated anyways
This commit is contained in:
Bob 2019-12-16 16:45:03 -05:00
parent 2ddd7acc8c
commit 6429f168e1
11 changed files with 141 additions and 92 deletions

View File

@ -13,9 +13,15 @@ include <src/key_profiles.scad>
include <src/key_types.scad> include <src/key_types.scad>
include <src/key_transformations.scad> include <src/key_transformations.scad>
include <src/key_helpers.scad> include <src/key_helpers.scad>
include <src/layouts.scad> include <src/key_layouts.scad>
for (x = [1:1:5]) { // example key
translate_u(0,-x) hipro_row(x) key(); dcs_row(5) legend("⇪", size=9) key();
translate_u(1,-x) sa_row(x) key();
} // example row
/* for (x = [0:1:4]) {
translate_u(0,-x) dcs_row(x) key();
} */
// example layout
/* preonic_default("dcs"); */

View File

@ -1,36 +0,0 @@
/*use <key.scad>*/
// NEED to include, not use this, even with the default variables set. don't know why
include <keys.scad>
60_percent = [
[1,1,1,1,1,1,1,1,1,1,1,1,1,2],
[1.5,1,1,1,1,1,1,1,1,1,1,1,1,1.5],
[1.75,1,1,1,1,1,1,1,1,1,1,1,2.25],
[2.25,1,1,1,1,1,1,1,1,1,1,2.75],
[1.25,1.25,1.25,6.25,1.25,1.25,1.25,1.25]
];
function sum(list, x=0) =
len(list) <= 1 ?
x + list[0] :
sum([for (x = [1: len(list) - 1]) list[x]], x+list[0]);
for (row = [0:len(60_percent)-1]){
for(column = [0:len(60_percent[row])-1]) {
columnDist = sum([for (x = [0 : column]) 60_percent[row][x]]);
a = 60_percent[row][column];
translate_u(columnDist - (a/2), -row) g20_row(3) u(a) cherry() { // (row+4) % 5 + 1
if (a == 6.25) {
spacebar() key();
} else if (a == 2.25) {
lshift() key();
} else if (a == 2) {
backspace() key();
} else if (a == 2.75) {
rshift() key();
} else {
key();
}
}
}
}

View File

@ -1,4 +1,13 @@
include <layouts/layout.scad>
include <layouts/preonic/default.scad>
include <layouts/preonic/mit.scad> include <layouts/preonic/mit.scad>
include <layouts/planck/default.scad>
include <layouts/planck/mit.scad> include <layouts/planck/mit.scad>
include <layouts/lets_split/default.scad> include <layouts/lets_split/default.scad>
include <layouts/project_zen/default.scad> include <layouts/project_zen/default.scad>
include <layouts/60_percent/default.scad>

View File

@ -10,7 +10,7 @@ module dcs_row(row=3, column=0) {
$dish_skew_y = 0; $dish_skew_y = 0;
$top_skew = 1.75; $top_skew = 1.75;
$top_tilt_y = column * 3; $top_tilt_y = column * 3.5;
// hack so you can do these in a for loop // hack so you can do these in a for loop
if (row == 5 || row == 0) { if (row == 5 || row == 0) {

View File

@ -0,0 +1,13 @@
include <../layout.scad>
60_percent = [
[1,1,1,1,1,1,1,1,1,1,1,1,1,2],
[1.5,1,1,1,1,1,1,1,1,1,1,1,1,1.5],
[1.75,1,1,1,1,1,1,1,1,1,1,1,2.25],
[2.25,1,1,1,1,1,1,1,1,1,1,2.75],
[1.25,1.25,1.25,6.25,1.25,1.25,1.25,1.25]
];
module 60_percent_default(profile) {
layout(60_percent, profile);
}

41
src/layouts/layout.scad Normal file
View File

@ -0,0 +1,41 @@
// sums all values, unless a value is negative, in which case it makes it positive
// dirty hack to allow for large gaps in keysets
function abs_sum(list, x=0) =
len(list) <= 1 ?
x + abs(list[0]) :
abs_sum([for (x = [1: len(list) - 1]) list[x]], x+abs(list[0]));
module layout(list, profile="dcs", row_sculpting_offset=0, row_override=undef) {
for (row = [0:len(list)-1]){
echo("**ROW**:", row);
row_length = len(list[row]);
for(column = [0:len(list[row])-1]) {
row_sculpting = (row_override != undef ? row_override : row) + row_sculpting_offset;
key_length = list[row][column];
// check if column is smack in middle of row - if so, no sculpting
// otherwise try to make two half-moon shapes, one for each side of the board
// since we are zero indexed, the 7th row has an index of 6 and is the center of 13. 6*2+1 = 13
double_sculpted_column = (column*2 + 1 == row_length) ? 0 : (column % (row_length/2)) - (row_length/4);
echo("double_sculpted_column", double_sculpted_column);
column_distance = abs_sum([for (x = [0 : column]) list[row][x]]);
if (key_length >= 1) {
translate_u(column_distance - (key_length/2), -row) key_profile(profile, row_sculpting, double_sculpted_column) u(key_length) cherry() { // (row+4) % 5 + 1
if (key_length == 6.25) {
spacebar() key();
} else if (key_length == 2.25) {
lshift() key();
} else if (key_length == 2) {
backspace() key();
} else if (key_length == 2.75) {
rshift() key();
} else {
key();
}
}
}
}
}
}

View File

@ -1,9 +1,13 @@
include <../layout.scad>
// negative numbers are used for spacing
lets_split_mapping = [
[1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1]
];
module lets_split_default(profile) { module lets_split_default(profile) {
for(x = [1:1:4]) { layout(lets_split_mapping, profile, row_sculpting_offset=1);
for(y=[-2.5:0.5:3]) {
translate_u(y > 0 ? y * 2 + 1 : y * 2,-x) key_profile(profile, x,floor(y)) {
key();
}
}
}
} }

View File

@ -0,0 +1,15 @@
include <../layout.scad>
// 0's are to make space for a middle row for just the spacebar so that it
// isn't sculpted with double sculpting. the 0's in the first three rows
// don't _need_ to be there but it's nice to keep track
planck_layout_mapping = [
[1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 0, 2, 0, 1, 1, 1, 1, 1]
];
module planck_default(profile) {
layout(planck_layout_mapping, profile, row_sculpting_offset=1);
}

View File

@ -1,9 +1,15 @@
include <../layout.scad>
// 0's are to make space for a middle row for just the spacebar so that it
// isn't sculpted with double sculpting. the 0's in the first three rows
// don't _need_ to be there but it's nice to keep track
planck_layout_mapping = [
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
];
module planck_mit(profile) { module planck_mit(profile) {
for(x = [1:1:4]) { layout(planck_layout_mapping, profile, row_sculpting_offset=1);
for(y=[-2.5:0.5:3]) {
translate_u(y * 2,-x) key_profile(profile, x,floor(y)) {
key();
}
}
}
} }

View File

@ -0,0 +1,13 @@
include <../layout.scad>
preonic_layout_mapping = [
[1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 0, 2, 0, 1, 1, 1, 1, 1]
];
module preonic_default(profile) {
layout(preonic_layout_mapping, profile);
}

View File

@ -1,41 +1,19 @@
/* function addl(list, c = 0) = include <../layout.scad>
c < len(list) - 1 ?
list[c] + addl(list, c + 1)
:
list[c]; */
function addl(list, c = 0, max=undef) = project_zen_main = [
max < c ? 0 : [1.5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.5],
(c < len(list) - 1) ? list[c] + addl(list, c + 1, max=max) : [1.5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.5],
list[c]; [1.5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.5],
[1.5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.5],
[1.5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.5]
];
function slidingSum(list, c = 1, max = undef) = project_zen_thumbs = [
c < 1 || c > len(list-1) ? 0 : [2,2],
c > max ? 0 : [2,2],
(list[c] + list[c-1])/2 + addl(list, c + 1, max=max); ];
module project_zen_default(profile) { module project_zen_default(profile) {
widths = [1.5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.5]; layout(project_zen_main, profile);
translations = [0,1.25,2.25,3.25,4.25,5.25,6.25,7.25,8.25,9.25,10.25,11.5]; translate_u(4.5,-5) layout(project_zen_thumbs, profile, row_override=3);
for(row = [0:1:4]) {
$t = 0;
for(column=[-2.5:0.5:3]) {
normalized_column = column*2 + 5;
$key_length = widths[normalized_column];
translate_u(translations[normalized_column],-row) key_profile(profile, row,floor(column)) {
key();
}
}
}
for (row=[0:1:1]) {
for (column=[0:1:1]) {
$key_length = 2;
translate_u(4.75 + row*2, -5 - column) key_profile(profile, 3,0) {
key();
}
}
}
} }