diff --git a/examples/plate_generation.scad b/examples/plate_generation.scad new file mode 100644 index 0000000..c137c99 --- /dev/null +++ b/examples/plate_generation.scad @@ -0,0 +1,6 @@ +include <../includes.scad> + +// plates are currently generated via the same layout arrays as layouts are. +// just pass the layout to plate() and it'll do it's job using hull(). +// still in beta +plate(60_percent_default_layout); \ No newline at end of file diff --git a/src/key.scad b/src/key.scad index 9ae3b6b..9823393 100644 --- a/src/key.scad +++ b/src/key.scad @@ -329,39 +329,22 @@ module clearance_check() { module legends(depth=0) { - if ($legends_dual) { + if (len($front_legends) > 0) { front_placement() { - 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); - } - } - } + if (len($front_legends) > 0) { + for (i=[0:len($front_legends)-1]) { + rotate([90,0,0]) keytext($front_legends[i][0], $front_legends[i][1], $front_legends[i][2], depth); + } + } + } + } + if (len($legends) > 0) { 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); - } - } } } } diff --git a/src/key_layouts.scad b/src/key_layouts.scad index ebe549c..0d36108 100644 --- a/src/key_layouts.scad +++ b/src/key_layouts.scad @@ -15,4 +15,6 @@ include include include -include \ No newline at end of file +include + +include \ No newline at end of file diff --git a/src/key_transformations.scad b/src/key_transformations.scad index 0420892..5db6780 100644 --- a/src/key_transformations.scad +++ b/src/key_transformations.scad @@ -131,9 +131,9 @@ module legend(text, position=[0,0], size=undef) { children(); } -module legend_front(text, position=[0,0], size=undef) { +module front_legend(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]; + $front_legends = [for(L=[$front_legends, [[text, position, font_size]]], a=L) a]; children(); } diff --git a/src/layouts/60_percent/default.scad b/src/layouts/60_percent/default.scad index 8ee33c4..0280b30 100644 --- a/src/layouts/60_percent/default.scad +++ b/src/layouts/60_percent/default.scad @@ -1,6 +1,6 @@ include <../layout.scad> -60_percent = [ +60_percent_default_layout = [ [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], @@ -17,5 +17,5 @@ include <../layout.scad> ]; module 60_percent_default(profile) { - layout(60_percent, profile, 60_percent_legends) children(); + layout(60_percent_default_layout, profile, 60_percent_legends) children(); } diff --git a/src/layouts/dactyl_manuform/4x6_legends.scad b/src/layouts/dactyl_manuform/4x6_legends.scad index 9d2d0c4..46c0ec9 100644 --- a/src/layouts/dactyl_manuform/4x6_legends.scad +++ b/src/layouts/dactyl_manuform/4x6_legends.scad @@ -26,7 +26,7 @@ dactyl_manuform_4x6_main_legends = [ ["", "", "CAPS", "T(1)", "", "", "", "", "", "T(2)", "]}", "", ""] ]; -dactyl_manuform_4x6_main_legends_front = [ +dactyl_manuform_4x6_main_front_legends = [ ["F1", "F2", "F3", "F4", "F5", "F6", "", "F7", "F8", "F9", "F10", "F11", "F12"], ["", "", "", "", "", "PGUP", "", "", "UP", "", "", "", ""], ["", "", "", "", "", "PGDN", "", "LFT", "DWN", "RHT", "", "", ""], @@ -39,7 +39,7 @@ dactyl_manuform_4x6_thumbs_l_legends = [ ["", "MEH", "T(2)"] ]; -dactyl_manuform_4x6_thumbs_l_legends_front = [ +dactyl_manuform_4x6_thumbs_l_front_legends = [ ["", ""], ["", "PSC", "LCMD"], ["", "", "TEMP"] @@ -51,14 +51,14 @@ dactyl_manuform_4x6_thumbs_r_legends = [ ["", "T(1)", "PST"] ]; -dactyl_manuform_4x6_thumbs_r_legends_front = [ +dactyl_manuform_4x6_thumbs_r_front_legends = [ ["", ""], ["", "", ""], ["", "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(); + layout(dactyl_manuform_4x6_main, profile, legends=dactyl_manuform_4x6_main_legends, front_legends=dactyl_manuform_4x6_main_front_legends, 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, front_legends=dactyl_manuform_4x6_thumbs_l_front_legends, 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, front_legends=dactyl_manuform_4x6_thumbs_r_front_legends, row_sculpting_offset=row_sculpting_offset, column_override=column_override, column_sculpt_profile="cresting_wave") children(); } \ No newline at end of file diff --git a/src/layouts/layout.scad b/src/layouts/layout.scad index c152553..cd3c9c2 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, legends_front=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) { for (row = [0:len(list)-1]){ /* echo("**ROW**:", row); */ row_length = len(list[row]); @@ -37,7 +37,7 @@ module layout(list, profile="dcs", legends=undef, legends_front=undef, row_sculp 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] : "") legend_front(legends_front ? legends_front[row][column] : "") cherry() { // (row+4) % 5 + 1 + 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 $row = row; $column = column; @@ -89,6 +89,11 @@ module layout(list, profile="dcs", legends=undef, legends_front=undef, row_sculp } } +// much simpler, decoupled layout function +// requires more setup - it only does what is in the layout array, which is translate +// and key length. you have to do row / column profile yourself and always pass +// children() +// this is probably the way we'll go forward module simple_layout(list) { for (row = [0:len(list)-1]){ /* echo("**ROW**:", row); */ diff --git a/src/layouts/plate.scad b/src/layouts/plate.scad new file mode 100644 index 0000000..73b3e75 --- /dev/null +++ b/src/layouts/plate.scad @@ -0,0 +1,31 @@ +// No support for stabilizers yet - but should be easy enough +// Won't work well for split layouts. or, it'll work fine - but it'll only be +// one plate. + +// each corner +module unit_corners(height = 3, radius=3, $fn=24) { + positions = [ + [-$key_length/2, -$key_height/2], + [$key_length/2, -$key_height/2], + [$key_length/2, $key_height/2], + [-$key_length/2, $key_height/2], + ]; + for (position = positions) { + translate_u(position.x, position.y) cylinder(h=height, r=radius, $fn=$fn); + } +} + +module switch_hole() { + cube(14, center=true); +} + + +module plate(layout_object) { + difference() { + hull() { + simple_layout(layout_object) unit_corners(); + } + + simple_layout(layout_object) switch_hole(); + } +} \ No newline at end of file diff --git a/src/settings.scad b/src/settings.scad index 6db5898..482c061 100644 --- a/src/settings.scad +++ b/src/settings.scad @@ -150,10 +150,7 @@ $legends = []; //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; +$front_legends = []; // make legends outset instead of inset. // broken off from artisan support since who wants outset legends?