diff --git a/keys.scad b/keys.scad index 768110e..9caa575 100644 --- a/keys.scad +++ b/keys.scad @@ -17,4 +17,13 @@ dcs_row(5) legend("⇪", size=9) key(); } */ // example layout -/* preonic_default("dcs"); */ \ No newline at end of file +// preonic_default("dcs") key(); + +// example dual top Legend row +// legend_test=[["{","["],["|","\\"],[":",";"],["?","/"],["_","-"]]; +// for (x = [0:1:4]) { +// translate_u(0,-x) dsa_row() legend(legend_test[x], [0,0,6]) key(); +// } + +// example dual top layout +// full_size_dual_default("cherry") key(); \ No newline at end of file diff --git a/src/features/legends.scad b/src/features/legends.scad index 2f0171a..117571f 100644 --- a/src/features/legends.scad +++ b/src/features/legends.scad @@ -3,7 +3,14 @@ module keytext(text, position, font_size, depth) { hoffset = (top_total_key_height()/3.5) * -position[1]; translate([woffset, hoffset, -depth]){ color($tertiary_color) linear_extrude(height=$dish_depth + depth){ - text(text=text, font=$font, size=font_size, halign="center", valign="center"); + // Allows for dual top keytext + if(is_list(text)&&len(text)==2){ + translate([0, (top_total_key_height()/4.25), 0]) text(text=text[0], font=$font, size=font_size*.70, halign="center", valign="center"); + translate([0, -(top_total_key_height()/4.25), 0]) text(text=text[1], font=$font, size=font_size*.70, halign="center", valign="center"); + } + else { + text(text=text, font=$font, size=font_size, halign="center", valign="center"); + } } } } diff --git a/src/key.scad b/src/key.scad index 15768ba..ec9c2d7 100644 --- a/src/key.scad +++ b/src/key.scad @@ -177,6 +177,14 @@ module inner_shape(extra_wall_thickness = 0, extra_keytop_thickness = 0) { // additive objects at the top of the key module additive_features(inset) { top_of_key() { + // Allow for key bump in layout + if ($layout_key_bump) { + for (layout_bump_key = $layout_bump_keys){ + if (str($legends[0][0]) == layout_bump_key){ + keybump($key_bump_depth, $key_bump_edge); + } + } + } if($key_bump) keybump($key_bump_depth, $key_bump_edge); if(!inset && $children > 0) color($secondary_color) children(); } diff --git a/src/key_layouts.scad b/src/key_layouts.scad index 10b5630..f06606a 100644 --- a/src/key_layouts.scad +++ b/src/key_layouts.scad @@ -18,3 +18,7 @@ include include include + +include +include +include \ No newline at end of file diff --git a/src/layouts/full_size/default.scad b/src/layouts/full_size/default.scad new file mode 100644 index 0000000..a88b013 --- /dev/null +++ b/src/layouts/full_size/default.scad @@ -0,0 +1,62 @@ +include <../layout.scad> + +full_size_default_layout = [ + [1,-1,1,1,1,1,-0.5,1,1,1,1,-0.5,1,1,1,1,-0.5,1,1,1], + [1,1,1,1,1,1,1,1,1,1,1,1,1,2,-0.5,1,1,1,-0.5,1,1,1,1], + [1.5,1,1,1,1,1,1,1,1,1,1,1,1,1.5,-0.5,1,1,1,-0.5,1,1,1,1], + [1.75,1,1,1,1,1,1,1,1,1,1,1,2.25,-4,1,1,1], + [2.25,1,1,1,1,1,1,1,1,1,1,2.75,-1.5,1,-1.5,1,1,1,1], + [1.25,1.25,1.25,6.25,1.25,1.25,1.25,1.25,-0.5,1,1,1,-0.5,2,1] +]; + +full_size_vertical_size = [ + [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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2], + [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, 2], + [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] +]; + +full_size_legend_size = [ + [-2, 0, -2, -2, -2, -2, 0, -2, -2, -2, -2, 0, -2, -2, -2, -2, 0, -3, -3, -2], + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, -3, -3, 0, -2, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, -2, -3, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2], + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] +]; + +full_size_legends = [ + ["esc", "", "f1", "f2", "f3", "f4", "", "f5", "f6", "f7", "f8", "", "f9", "f10", "f11", "f12", "", "ptsc", "sclk", "pse"], + ["`", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "-", "=", "⌫", "", "ins", "home", "pgup", "", "num", "/", "*", "-"], + ["tab", "q", "w", "e", "r", "t", "y", "u", "i", "o", "p", "[", "]", "\\", "", "del", "end", "pgdn", "", "7", "8", "9", "+"], + ["caps", "a", "s", "d", "f", "g", "h", "j", "k", "l", ";", "'", "enter", "", "4", "5", "6"], + ["shift", "z", "x", "c", "v", "b", "n", "m", ",", ".", "/", "shift", "", "up", "", "1", "2", "3", "ent"], + ["ctl", "win", "alt", "", "mnu", "win", "alt", "ctl", "", "lt", "dn", "rt", "", "0", "."], +]; + + +module full_size_default(profile="dcs") { + simple_layout(full_size_default_layout) { + fs_legend = full_size_legends[$row][$column]; + echo(fs_legend); + legend_size = $font_size + full_size_legend_size[$row][$column]; + vertical_size = full_size_vertical_size[$row][$column]; + + legend(fs_legend, size=legend_size) { + key_profile(profile, $row, $column) { + if(vertical_size > 1){ + v_offset = -(vertical_size - 1) / 2; + translate_u(0, v_offset){ + uh(vertical_size) { + stabilized(vertical=true) key(); + } + } + } else { + key(); + } + } + } + } +} \ No newline at end of file diff --git a/src/layouts/full_size_dual/default.scad b/src/layouts/full_size_dual/default.scad new file mode 100644 index 0000000..fd77678 --- /dev/null +++ b/src/layouts/full_size_dual/default.scad @@ -0,0 +1,46 @@ +include <../layout.scad> + +rt_arrow="\u2192"; +lt_arrow="\u2190"; +up_arrow="\u2191"; +dn_arrow="\u2193"; +menu="\u2261"; +enter=lt_arrow; //"\u2386" with supported Unicode Font +backspace="BkSp"; //"\u232B" with supported Unicode Font + +// Keys are defined independently: [legend, horizontalSize, verticalSize, fontChg] +full_size_dual = [[["Esc",1,1,-2], ["",-1,1,0], ["F1",1,1,-2], ["F2",1,1,-2], ["F3",1,1,-2], ["F4",1,1,-2], ["",-.5,1,0], ["F5",1,1,-2], ["F6",1,1,-2], ["F7",1,1,-2], ["F8",1,1,-2], ["",-.5,1,0], ["F9",1,1,-2], ["F10",1,1,-2], ["F11",1,1,-2], ["F12",1,1,-2], ["",-0.5,1,0], [["Print","Screen"],1,1,-3], [["Scroll", "Lock"],1,1,-3], [["Pause","Break"],1,1,-3]], + [[["~","`"],1,1,0], [["!","1"],1,1,0], [["@","2"],1,1,0], [["#","3"],1,1,0], [["$","4"],1,1,0], [["%","5"],1,1,0], [["^","6"],1,1,0], [["&","7"],1,1,0], [["*","8"],1,1,0], [["(","9"],1,1,0], [[")","0"],1,1,0], [["_","-"],1,1,0], [["+","="],1,1,0], [backspace,2,1,-2], ["",-0.5,1,0], ["Ins",1,1,-2], ["Home",1,1,-2], [["Pg","Up"],1,1,-1], ["",-0.5,1,0], [["Num","Lock"],1,1,-2], ["/",1,1,0], ["*",1,1,0], ["-",1,1,0]], + [["Tab",1.5,1,-2], ["Q",1,1,0], ["W",1,1,0], ["E",1,1,0], ["R",1,1,0], ["T",1,1,-2], ["Y",1,1,0], ["U",1,1,0], ["I",1,1,0], ["O",1,1,0], ["P",1,1,0], [["{","["],1,1,0], [["}","]"],1,1,0], [["|","\\"],1.5,1,0], ["",-0.5,1,0], ["Del",1,1,-2], ["End",1,1,-2], [["Pg","Dn"],1,1,-1], ["",-0.5,1,0], ["7",1,1,0], ["8",1,1,0], ["9",1,1,0], ["+",1,2,0]], + [["Caps",1.75,1,-2], ["A",1,1,0], ["S",1,1,0], ["D",1,1,0], ["F",1,1,-2], ["G",1,1,0], ["H",1,1,0], ["J",1,1,0], ["K",1,1,0], ["L",1,1,0], [[":",";"],1,1,0], [["\"","'"],1,1,0], ["Enter",2.25,1,-2], ["",-4,1,0], ["4",1,1,0], ["5",1,1,0], ["6",1,1,0]], + [["Shift",2.25,1,-2], ["Z",1,1,0], ["X",1,1,0], ["C",1,1,-2], ["V",1,1,0], ["B",1,1,0], ["N",1,1,0], ["M",1,1,0], [["<",","],1,1,0], [[">","."],1,1,0], [["?","/"],1,1,0], ["Shift",2.75,1,-2], ["",-1.5,1,0], [up_arrow,1,1,0], ["",-1.5,1,0], ["1",1,1,0], ["2",1,1,0], ["3",1,1,0], [enter,1,2,0]], + [["Ctrl",1.25,1,-2], ["Win",1.25,1,-2], ["Alt",1.25,1,-2], ["",6.25,1,0], ["Alt",1.25,1,-2], ["FN",1.25,1,-2], [menu,1.25,1,0], ["Ctrl",1.25,1,-2], ["",-0.5,1,0], [lt_arrow,1,1,0], [dn_arrow,1,1,0], [rt_arrow,1,1,0], ["",-0.5,1,0], ["0",2,1,0], [".",1,1,0]]]; + +// Derive/seperate out tables +full_size_dual_legends = [ for (row = full_size_dual) [ for (col = row) col[0]]]; +full_size_dual_default_layout = [ for (row = full_size_dual) [ for (col = row) col[1]]]; +full_size_dual_vertical_size = [ for (row = full_size_dual) [ for (col = row) col[2]]]; +full_size_dual_legend_size = [ for (row = full_size_dual) [ for (col = row) col[3]]]; + +module full_size_dual_default(profile="dcs") { + simple_layout(full_size_dual_default_layout) { + dual_legend = full_size_dual_legends[$row][$column]; + legend_size = $font_size+full_size_dual_legend_size[$row][$column]; + vertical_size = full_size_dual_vertical_size[$row][$column]; + + legend(dual_legend, size=legend_size) { + key_profile(profile, $row, $column) { + if(vertical_size > 1){ + v_offset = -(vertical_size - 1) / 2; + translate_u(0, v_offset){ + uh(vertical_size) { + stabilized(vertical=true) key(); + } + } + } else { + key(); + } + } + } + } +} \ No newline at end of file diff --git a/src/layouts/layout.scad b/src/layouts/layout.scad index cd3c9c2..08d6d98 100644 --- a/src/layouts/layout.scad +++ b/src/layouts/layout.scad @@ -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, front_legends=undef, row_sculpting_offset=0, row_override=undef, column_sculpt_profile="2hands", column_override=undef) { +module layout(list, profile="dcs", legends=undef, front_legends=undef, row_sculpting_offset=0, row_override=undef, column_sculpt_profile="2hands", column_override=undef, legend_sizes=undef, vertical_sizes=undef) { for (row = [0:len(list)-1]){ /* echo("**ROW**:", row); */ row_length = len(list[row]); @@ -28,6 +28,8 @@ module layout(list, profile="dcs", legends=undef, front_legends=undef, row_sculp for(column = column_override ? column_override : [0:len(list[row])-1]) { row_sculpting = (row_override != undef ? row_override : row) + row_sculpting_offset; key_length = list[row][column]; + key_height = vertical_sizes ? vertical_sizes[row][column] : 1; + v_offset = (key_height - 1) / 2; column_value = double_sculpted_column(column, row_length, column_sculpt_profile); column_distance = abs_sum([for (x = [0 : column]) list[row][x]]); @@ -35,9 +37,9 @@ module layout(list, profile="dcs", legends=undef, front_legends=undef, row_sculp // supports negative values for nonexistent keys if (key_length >= 1) { - translate_u(column_distance - (key_length/2), -row) { + translate_u(column_distance - (key_length/2), -row-v_offset) { - key_profile(profile, row_sculpting, column_value) u(key_length) legend(legends ? legends[row][column] : "") front_legend(front_legends ? front_legends[row][column] : "") cherry() { // (row+4) % 5 + 1 + key_profile(profile, row_sculpting, column_value) u(key_length) uh(key_height) legend(legends ? legends[row][column] : "", size=legend_sizes ? $font_size+legend_sizes[row][column] : $font_size) front_legend(front_legends ? front_legends[row][column] : "") cherry() { // (row+4) % 5 + 1 $row = row; $column = column; diff --git a/src/layouts/tkl/default.scad b/src/layouts/tkl/default.scad new file mode 100644 index 0000000..577cc5c --- /dev/null +++ b/src/layouts/tkl/default.scad @@ -0,0 +1,38 @@ +include <../layout.scad> + +tkl_default_layout = [ + [1,-1,1,1,1,1,-0.5,1,1,1,1,-0.5,1,1,1,1,-0.5,1,1,1], + [1,1,1,1,1,1,1,1,1,1,1,1,1,2,-0.5,1,1,1], + [1.5,1,1,1,1,1,1,1,1,1,1,1,1,1.5,-0.5,1,1,1], + [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.5,1], + [1.25,1.25,1.25,6.25,1.25,1.25,1.25,1.25,-0.5,1,1,1] +]; + +tkl_legend_size = [ + [-2, 0, -2, -2, -2, -2, 0, -2, -2, -2, -2, 0, -2, -2, -2, -2, 0, -3, -3, -2], + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, -3, -3], + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, -2, -3], + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]; + +tkl_legends = [ + ["esc", "", "f1", "f2", "f3", "f4", "", "f5", "f6", "f7", "f8", "", "f9", "f10", "f11", "f12", "", "ptsc", "sclk", "pse"], + ["`", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "-", "=", "⌫", "", "ins", "home", "pgup"], + ["tab", "q", "w", "e", "r", "t", "y", "u", "i", "o", "p", "[", "]", "\\", "", "del", "end", "pgdn"], + ["caps", "a", "s", "d", "f", "g", "h", "j", "k", "l", ";", "'", "enter"], + ["shift", "z", "x", "c", "v", "b", "n", "m", ",", ".", "/", "shift", "", "up"], + ["ctl", "win", "alt", "", "mnu", "win", "alt", "ctl", "", "lt", "dn", "rt"], +]; + +module tkl_default(profile="dcs") { + simple_layout(tkl_default_layout) { + tkl_legend = tkl_legends[$row][$column]; + legend_size = $font_size + tkl_legend_size[$row][$column]; + + legend(tkl_legend, size=legend_size) { + key_profile(profile, $row, $column) key(); + } + } +} \ No newline at end of file diff --git a/src/settings.scad b/src/settings.scad index 29da524..cf83c66 100644 --- a/src/settings.scad +++ b/src/settings.scad @@ -136,6 +136,8 @@ $minkowski_radius = .33; //insert locating bump $key_bump = false; +$layout_key_bump = false; +$layout_bump_keys = ["F","f","J","j"]; //height of the location bump from the top surface of the key $key_bump_depth = 0.5; //distance to move the bump from the front edge of the key