Add plate generator

it only generates unibody plates with hull(), but it does a pretty good job!
This commit is contained in:
Bob 2020-03-05 13:03:17 -05:00
parent e87bd2ad49
commit 16a6e6c324
5 changed files with 46 additions and 2 deletions

View File

@ -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);

View File

@ -13,3 +13,5 @@ include <layouts/project_zen/default.scad>
include <layouts/60_percent/default.scad>
include <layouts/gherkin/default.scad>
include <layouts/gherkin/gherkin_bump.scad>
include <layouts/plate.scad>

View File

@ -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();
}

View File

@ -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); */

31
src/layouts/plate.scad Normal file
View File

@ -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();
}
}