scad/atreoid-bosl.scad

167 lines
5.8 KiB
OpenSCAD

include <BOSL2/std.scad>
include <BOSL2/screws.scad>
include <BOSL2/hinges.scad>
$fn = 24;
// $half="right";
// $half="left";
$half=0;
// $center_w = 0;
$center_w = 40;
$plate_depth = 3.3;
$base_joiner_h = 10;
$half_w = 155;
$half_h = 140;
// generated from points.yaml...
array = [[6.4249826, 36.4378869, -10], // matrix_pinkycluster_home
[9.7242979, 55.1492342, -10], // matrix_pinkycluster_top
[23.3998481, 23.290494, -10], // matrix_pinky_home
[26.6991635, 42.0018413, -10], // matrix_pinky_top
[29.9984789, 60.7131886, -10], // matrix_pinky_num
[40.5483618, 11.1279088, -10], // matrix_ring_bottom
[43.8476772, 29.8392561, -10], // matrix_ring_home
[47.1469926, 48.5506034, -10], // matrix_ring_top
[50.4463079, 67.2619507, -10], // matrix_ring_num
[60.6488945, 15.7070555, -10], // matrix_middle_bottom
[63.9482099, 34.4184028, -10], // matrix_middle_home
[67.2475253, 53.1297501, -10], // matrix_middle_top
[70.5468407, 71.8410974, -10], // matrix_middle_num
[76.581871, -3.349184, -10], // matrix_index_bottom
[79.8811864, 15.3621633, -10], // matrix_index_home
[83.1805018, 34.0735106, -10], // matrix_index_top
[86.4798171, 52.7848579, -10], // matrix_index_num
[94.5986256, -10.5877304, -10], // matrix_inner_bottom
[97.897941, 8.1236169, -10], // matrix_inner_home
[101.1972564, 26.8349643, -10], // matrix_inner_top
[104.4965717, 45.5463116, -10], // matrix_inner_num
[112.2680838, -19.7958923, -10], // matrix_thumb_bottom
[115.5673992, -1.0845449, -10], // matrix_thumb_home
[118.8667146, 17.6268024, -10], // matrix_thumb_top
];
keyboard_plate();
module center_plate() {
diff() cube([$center_w,$half_h,$plate_depth], anchor=BOTTOM) {
fwd(10) position(RIGHT+BACK) attach(BOTTOM, overlap=1) right_hinge();
fwd(10) position(LEFT+BACK) attach(BOTTOM, overlap=1) left_hinge();
back(10) position(LEFT+FRONT) attach(BOTTOM, overlap=1) zrot(180) right_hinge();
back(10) position(RIGHT+FRONT) attach(BOTTOM, overlap=1) zrot(180) left_hinge();
}
}
module keyboard_plate() {
union() {
// right hand
if($half == 0 || $half == "right")
recolor("red")
diff() cube([$half_w,$half_h,$plate_depth], anchor=BOTTOM) {
right(5) position(FWD) xdistribute(l=$half_h) {
corner_mount(width=5, anchor=BOTTOM+LEFT+BACK);
corner_mount(width=5, anchor=BOTTOM+BACK);
corner_mount(width=5, anchor=BOTTOM+BACK);
corner_mount(width=5, anchor=BOTTOM+RIGHT+BACK);
}
right(5) position(BACK) xdistribute(l=$half_h) {
corner_mount(width=5, anchor=BOTTOM+LEFT+FWD);
corner_mount(width=5, anchor=BOTTOM+FWD);
corner_mount(width=5, anchor=BOTTOM+FWD);
corner_mount(width=5, anchor=BOTTOM+RIGHT+FWD);
}
fwd(10) position(LEFT+BACK) attach(BOTTOM, overlap=1) left_hinge();
back(10) position(LEFT+FRONT) attach(BOTTOM, overlap=1) zrot(180) right_hinge();
attach(TOP, TOP) down($plate_depth) tag("remove") keys();
attach(TOP, BOTTOM) left(38) back(40) zrot(10) tag("remove") track_cutout();
}
if ($center_w > 0 && $half == 0){
left($half_w/2+$center_w/2)
center_plate();
}
if($half == 0 || $half == "left")
// left hand
recolor("blue")
left($half_w+$center_w) diff() cube([$half_w,$half_h,$plate_depth], anchor=BOTTOM) {
left(5) position(FWD) xdistribute(l=$half_h) {
corner_mount(width=5, anchor=BOTTOM+LEFT+BACK);
corner_mount(width=5, anchor=BOTTOM+BACK);
corner_mount(width=5, anchor=BOTTOM+BACK);
corner_mount(width=5, anchor=BOTTOM+RIGHT+BACK);
}
left(5) position(BACK) xdistribute(l=$half_h) {
corner_mount(width=5, anchor=BOTTOM+LEFT+FWD);
corner_mount(width=5, anchor=BOTTOM+FWD);
corner_mount(width=5, anchor=BOTTOM+FWD);
corner_mount(width=5, anchor=BOTTOM+RIGHT+FWD);
}
fwd(10) position(RIGHT+BACK) attach(BOTTOM, overlap=1) right_hinge();
back(10) position(RIGHT+FRONT) attach(BOTTOM, overlap=1) zrot(180) left_hinge();
attach(TOP, TOP) down($plate_depth) tag("remove") xflip() keys();
}
}
}
module corner_mount(width=5, anchor) {
render() xrot(180)
up(1.6)
cube([width, width, 1], anchor=anchor)
attach(TOP, BOTTOM) cyl(h=$base_joiner_h-1, d1=width, d2=width*0.8, anchor=BOTTOM, rounding2=1);
}
module track_cutout() {
render() attachable(size=[22,19,6]) {
down(3+$plate_depth) zrot(180)
cuboid([22.8, 12.3, 1]) {
attach(FRONT, BACK) cuboid([13.1, 7.1, 1]);
attach(TOP, BOTTOM) xdistribute(l=19) {
cyl(d=1.5, h=5);
cyl(d=6.5+2, h=5);
cyl(d=1.5, h=5);
}
};
children();
}
}
module keys() {
render() attachable(size=[131,110, 3.3]) {
// cuboid([131,110, 3.3]);
recolor("blue") left(71) fwd(32) down(3.3/2)
union() for (tuple = array) {
translate([tuple[0], tuple[1],0]) {
rotate([0,0, tuple[2]]) {
translate([-0.5,-0.5,-0.1])
cube([15,15,2.1]);
translate([0,0,2])
cube([14, 14, 1.4]);
}
}
};
children();
}
}
// module bolt_block(len=$base_joiner_h*2) {
// xrot(90) render() // diff()
// cuboid([$base_joiner_h, $base_joiner_h, len],
// rounding=$base_joiner_h*0.3,
// edges=[BACK, TOP, BOTTOM],
// anchor=FRONT, orient=RIGHT)
// screw_hole("M3", length=len, head="socket", counterbore=6, anchor=CENTER)
// position(BOT) nut_trap_inline(l=6,anchor=BOT);
// }
module left_hinge() {
zrot(-90) knuckle_hinge($base_joiner_h*2, offset=7, segs=3, inner=true);
}
module right_hinge() {
zrot(90) knuckle_hinge($base_joiner_h*2, offset=7, segs=3);
}