mirror of
https://github.com/rsheldiii/KeyV2.git
synced 2025-02-16 22:37:03 +00:00
Add plate generator
it only generates unibody plates with hull(), but it does a pretty good job!
This commit is contained in:
parent
e87bd2ad49
commit
16a6e6c324
5 changed files with 46 additions and 2 deletions
6
examples/plate_generation.scad
Normal file
6
examples/plate_generation.scad
Normal 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);
|
|
@ -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>
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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
31
src/layouts/plate.scad
Normal 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();
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue