mirror of
https://github.com/rsheldiii/KeyV2.git
synced 2024-11-26 06:45:28 +00:00
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:
parent
2ddd7acc8c
commit
6429f168e1
16
keys.scad
16
keys.scad
@ -13,9 +13,15 @@ include <src/key_profiles.scad>
|
||||
include <src/key_types.scad>
|
||||
include <src/key_transformations.scad>
|
||||
include <src/key_helpers.scad>
|
||||
include <src/layouts.scad>
|
||||
include <src/key_layouts.scad>
|
||||
|
||||
for (x = [1:1:5]) {
|
||||
translate_u(0,-x) hipro_row(x) key();
|
||||
translate_u(1,-x) sa_row(x) key();
|
||||
}
|
||||
// example key
|
||||
dcs_row(5) legend("⇪", size=9) key();
|
||||
|
||||
// example row
|
||||
/* for (x = [0:1:4]) {
|
||||
translate_u(0,-x) dcs_row(x) key();
|
||||
} */
|
||||
|
||||
// example layout
|
||||
/* preonic_default("dcs"); */
|
||||
|
36
keysets.scad
36
keysets.scad
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,4 +1,13 @@
|
||||
include <layouts/layout.scad>
|
||||
|
||||
include <layouts/preonic/default.scad>
|
||||
include <layouts/preonic/mit.scad>
|
||||
|
||||
include <layouts/planck/default.scad>
|
||||
include <layouts/planck/mit.scad>
|
||||
|
||||
include <layouts/lets_split/default.scad>
|
||||
|
||||
include <layouts/project_zen/default.scad>
|
||||
|
||||
include <layouts/60_percent/default.scad>
|
@ -10,7 +10,7 @@ module dcs_row(row=3, column=0) {
|
||||
$dish_skew_y = 0;
|
||||
$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
|
||||
if (row == 5 || row == 0) {
|
||||
|
13
src/layouts/60_percent/default.scad
Normal file
13
src/layouts/60_percent/default.scad
Normal 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
41
src/layouts/layout.scad
Normal 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -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) {
|
||||
for(x = [1:1:4]) {
|
||||
for(y=[-2.5:0.5:3]) {
|
||||
translate_u(y > 0 ? y * 2 + 1 : y * 2,-x) key_profile(profile, x,floor(y)) {
|
||||
key();
|
||||
}
|
||||
}
|
||||
}
|
||||
layout(lets_split_mapping, profile, row_sculpting_offset=1);
|
||||
}
|
||||
|
15
src/layouts/planck/default.scad
Normal file
15
src/layouts/planck/default.scad
Normal 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);
|
||||
}
|
@ -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) {
|
||||
for(x = [1:1:4]) {
|
||||
for(y=[-2.5:0.5:3]) {
|
||||
translate_u(y * 2,-x) key_profile(profile, x,floor(y)) {
|
||||
key();
|
||||
}
|
||||
}
|
||||
}
|
||||
layout(planck_layout_mapping, profile, row_sculpting_offset=1);
|
||||
}
|
||||
|
13
src/layouts/preonic/default.scad
Normal file
13
src/layouts/preonic/default.scad
Normal 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);
|
||||
}
|
@ -1,41 +1,19 @@
|
||||
/* function addl(list, c = 0) =
|
||||
c < len(list) - 1 ?
|
||||
list[c] + addl(list, c + 1)
|
||||
:
|
||||
list[c]; */
|
||||
include <../layout.scad>
|
||||
|
||||
function addl(list, c = 0, max=undef) =
|
||||
max < c ? 0 :
|
||||
(c < len(list) - 1) ? list[c] + addl(list, c + 1, max=max) :
|
||||
list[c];
|
||||
project_zen_main = [
|
||||
[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],
|
||||
[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) =
|
||||
c < 1 || c > len(list-1) ? 0 :
|
||||
c > max ? 0 :
|
||||
(list[c] + list[c-1])/2 + addl(list, c + 1, max=max);
|
||||
project_zen_thumbs = [
|
||||
[2,2],
|
||||
[2,2],
|
||||
];
|
||||
|
||||
module project_zen_default(profile) {
|
||||
widths = [1.5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.5];
|
||||
translations = [0,1.25,2.25,3.25,4.25,5.25,6.25,7.25,8.25,9.25,10.25,11.5];
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
layout(project_zen_main, profile);
|
||||
translate_u(4.5,-5) layout(project_zen_thumbs, profile, row_override=3);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user