diff --git a/examples/plate_generation.scad b/examples/plate_generation.scad new file mode 100644 index 0000000..11bdcc3 --- /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); diff --git a/src/key_layouts.scad b/src/key_layouts.scad index 28e2194..ae79212 100644 --- a/src/key_layouts.scad +++ b/src/key_layouts.scad @@ -13,3 +13,5 @@ include include include include + +include 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/layout.scad b/src/layouts/layout.scad index d494019..19e66e4 100644 --- a/src/layouts/layout.scad +++ b/src/layouts/layout.scad @@ -88,6 +88,11 @@ module layout(list, profile="dcs", legends=undef, row_sculpting_offset=0, row_ov } } +// 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..6eb4208 --- /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(); + } +}