Support for dual legends

Adds support for adding front and top legends
This commit is contained in:
IhatemyISP 2020-02-16 02:23:24 -05:00
parent 3f5ca9aa42
commit f5429b330a
No known key found for this signature in database
GPG Key ID: C87915CB776E8490
5 changed files with 71 additions and 19 deletions

View File

@ -328,21 +328,39 @@ module clearance_check() {
}
module legends(depth) {
if ($front_print_legends) {
if ($legends_dual) {
front_placement() {
if (len($legends) > 0) {
for (i=[0:len($legends)-1]) {
rotate([90,0,0]) keytext($legends[i][0], $legends[i][1], $legends[i][2], depth);
}
}
}
} else {
if (len($legends_front) > 0) {
for (i=[0:len($legends_front)-1]) {
rotate([90,0,0]) keytext($legends_front[i][0], $legends_front[i][1], $legends_front[i][2], depth);
}
}
}
top_of_key() {
// outset legend
if (len($legends) > 0) {
for (i=[0:len($legends)-1]) {
keytext($legends[i][0], $legends[i][1], $legends[i][2], depth);
}
}
}
} else {
if ($front_print_legends) {
front_placement() {
if (len($legends) > 0) {
for (i=[0:len($legends)-1]) {
rotate([90,0,0]) keytext($legends[i][0], $legends[i][1], $legends[i][2], depth);
}
}
}
} else {
top_of_key() {
// outset legend
if (len($legends) > 0) {
for (i=[0:len($legends)-1]) {
keytext($legends[i][0], $legends[i][1], $legends[i][2], depth);
}
}
}
}
}

View File

@ -131,6 +131,12 @@ module legend(text, position=[0,0], size=undef) {
children();
}
module legend_front(text, position=[0,0], size=undef) {
font_size = size == undef ? $font_size : size;
$legends_front = [for(L=[$legends_front, [[text, position, font_size]]], a=L) a];
children();
}
module bump(depth=undef) {
$key_bump = true;
$key_bump_depth = depth == undef ? $key_bump_depth : depth;

View File

@ -23,23 +23,42 @@ dactyl_manuform_4x6_main_legends = [
["ESC", "Q", "W", "E", "R", "T", "", "Y", "U", "I", "O", "P", "{["],
["LS", "A", "S", "D", "F", "G", "", "H", "J", "K", "L", ";:", "'\""],
["TAB", "Z", "X", "C", "V", "B", "", "N", "M", ",<", ".>", "/?", "\\|"],
["", "", "CAPS", "T(2)", "", "", "", "", "", "T(1)", "]}", "", ""]
["", "", "CAPS", "T(1)", "", "", "", "", "", "T(2)", "]}", "", ""]
];
dactyl_manuform_4x6_main_legends_front = [
["F1", "F2", "F3", "F4", "F5", "F6", "", "F7", "F8", "F9", "F10", "F11", "F12"],
["", "", "", "", "", "PGUP", "", "", "UP", "", "", "", ""],
["", "", "", "", "", "PGDN", "", "LFT", "DWN", "RHT", "", "", ""],
["", "", "", "T(0)", "", "", "", "", "", "T(2)", "", "", ""]
];
dactyl_manuform_4x6_thumbs_l_legends = [
["~`", "LCTL"],
["", "RALT", "CMD"],
["", "MEH", "T(2^)"]
["", "RALT", "LCMD"],
["", "MEH", "T(2)"]
];
dactyl_manuform_4x6_thumbs_l_legends_front = [
["", ""],
["", "PSC", "LCMD"],
["", "", "TEMP"]
];
dactyl_manuform_4x6_thumbs_r_legends = [
["", "BKSP"],
["", "ENTR", "CP"],
["", "T(1^)", "PST"]
["", "T(1)", "PST"]
];
module dactyl_manuform_4x6_legends(profile) {
layout(dactyl_manuform_4x6_main, profile, legends=dactyl_manuform_4x6_main_legends) children();
translate_u(3,-5) rotate([0,0,25]) layout(dactyl_manuform_4x6_thumbs_l, profile, legends=dactyl_manuform_4x6_thumbs_l_legends, row_override=3) children();
translate_u(7.75,-3.95) rotate([0,0,-25]) layout(dactyl_manuform_4x6_thumbs_r, profile, legends=dactyl_manuform_4x6_thumbs_r_legends, row_override=3) children();
}
dactyl_manuform_4x6_thumbs_r_legends_front = [
["", ""],
["", "", ""],
["", "TEMP", ""]
];
module dactyl_manuform_4x6_legends(profile, row_sculpting_offset=1, column_override=undef) {
layout(dactyl_manuform_4x6_main, profile, legends=dactyl_manuform_4x6_main_legends, legends_front=dactyl_manuform_4x6_main_legends_front, row_sculpting_offset=row_sculpting_offset, column_override=column_override, column_sculpt_profile="cresting_wave") children();
translate_u(3,-5) rotate([0,0,25]) layout(dactyl_manuform_4x6_thumbs_l, profile, legends=dactyl_manuform_4x6_thumbs_l_legends, legends_front=dactyl_manuform_4x6_thumbs_l_legends_front, row_sculpting_offset=row_sculpting_offset, column_override=column_override, column_sculpt_profile="cresting_wave") children();
translate_u(7.75,-3.95) rotate([0,0,-25]) layout(dactyl_manuform_4x6_thumbs_r, profile, legends=dactyl_manuform_4x6_thumbs_r_legends, legends_front=dactyl_manuform_4x6_thumbs_r_legends_front, row_sculpting_offset=row_sculpting_offset, column_override=column_override, column_sculpt_profile="cresting_wave") children();
}

View File

@ -20,7 +20,7 @@ function double_sculpted_column(column, row_length, column_sculpt_profile) =
1hand(column, row_length) : (column_sculpt_profile == "cresting_wave") ?
cresting_wave(column, row_length) : 0;
module layout(list, profile="dcs", legends=undef, row_sculpting_offset=0, row_override=undef, column_sculpt_profile="2hands", column_override=undef) {
module layout(list, profile="dcs", legends=undef, legends_front=undef, row_sculpting_offset=0, row_override=undef, column_sculpt_profile="2hands", column_override=undef) {
for (row = [0:len(list)-1]){
echo("**ROW**:", row);
row_length = len(list[row]);
@ -36,7 +36,7 @@ module layout(list, profile="dcs", legends=undef, row_sculpting_offset=0, row_ov
// supports negative values for nonexistent keys
if (key_length >= 1) {
translate_u(column_distance - (key_length/2), -row) {
key_profile(profile, row_sculpting, column_value) u(key_length) legend(legends ? legends[row][column] : "") cherry() { // (row+4) % 5 + 1
key_profile(profile, row_sculpting, column_value) u(key_length) legend(legends ? legends[row][column] : "") legend_front(legends_front ? legends_front[row][column] : "") cherry() { // (row+4) % 5 + 1
if (key_length == 6.25) {
spacebar() {
if ($children) {

View File

@ -146,6 +146,15 @@ $key_bump_edge = 0.4;
// Currently does not work with thingiverse customizer, and actually breaks it
$legends = [];
//list of front legends to place on a key format: [text, halign, valign, size]
//halign = "left" or "center" or "right"
//valign = "top" or "center" or "bottom"
// Currently does not work with thingiverse customizer, and actually breaks it
$legends_front = [];
//print both top and front legends
$legends_dual = false;
// make legends outset instead of inset.
// broken off from artisan support since who wants outset legends?
$outset_legends = false;