new stuff
This commit is contained in:
parent
ac7386074e
commit
462d2bfb6c
8 changed files with 215 additions and 130 deletions
37
lib/key.scad
37
lib/key.scad
|
|
@ -1,24 +1,27 @@
|
|||
// Generate a key cap at a specific position in the matrix
|
||||
module key(x, y, w=1, h=1, label="") {
|
||||
spacing_h = 1;
|
||||
spacing_v = 1;
|
||||
key_thickness = 1;
|
||||
key_radius = 1;
|
||||
key_width = 1;
|
||||
key_height = 1;
|
||||
mat_thickness = 1;
|
||||
|
||||
color("DarkSlateGray");
|
||||
translate([x*spacing_h, y*spacing_v, mat_thickness]) difference() {
|
||||
module key(x, y, w=1, h=1, label="", spacing=1, size=3.5) {
|
||||
include <key_specs.scad>;
|
||||
$fn = 64;
|
||||
|
||||
color("DarkSlateGray") translate([x*key_width + x*padding + margin, y*key_height + y*padding + margin, mat_thickness]) difference() {
|
||||
union() {
|
||||
hull() {
|
||||
translate([key_radius, key_radius, 0]) cylinder(h=key_thickness, r=key_radius);
|
||||
translate([key_radius, key_height-key_radius, 0]) cylinder(h=key_thickness, r=key_radius);
|
||||
translate([key_width-key_radius, key_radius, 0]) cylinder(h=key_thickness, r=key_radius);
|
||||
translate([key_width-key_radius, key_height-key_radius, 0]) cylinder(h=key_thickness, r=key_radius);
|
||||
translate([key_radius, key_radius, 0]) cylinder(h=key_thickness, r=key_radius);
|
||||
translate([key_radius, key_height*h + padding*(h-1) - key_radius, 0]) cylinder(h=key_thickness, r=key_radius);
|
||||
translate([key_width*w + padding*(w-1) - key_radius, key_radius, 0]) cylinder(h=key_thickness, r=key_radius);
|
||||
translate([key_width*w + padding*(w-1) - key_radius, key_height*h + padding*(h-1) - key_radius, 0]) cylinder(h=key_thickness, r=key_radius);
|
||||
}
|
||||
}
|
||||
// TODO: subtract label from key cap
|
||||
// indent instead of dome
|
||||
translate([0,0,key_thickness]) hull() {
|
||||
translate([1.1, 1.1, 0]) scale([1,1,0.3]) sphere(r=1);
|
||||
translate([key_width*w + padding*(w-1) - 1.1, 1.1, 0]) scale([1,1,0.3]) sphere(r=1);
|
||||
translate([1.1, key_height*h + padding*(h-1) - 1.1, 0]) scale([1,1,0.3]) sphere(r=1);
|
||||
translate([key_width*w + padding*(w-1) - 1.1, key_height*h + padding*(h-1) - 1.1, 0]) scale([1,1,0.3]) sphere(r=1);
|
||||
}
|
||||
// depth of 0.3mm+
|
||||
// Noto Sans Mono:style=Medium
|
||||
// subtract label from key cap
|
||||
translate([(key_width*w + padding*(w-1))/2 -(0.5/spacing-0.5), (key_height*h + padding*(h-1))/2, key_thickness-0.5]) linear_extrude(height=1) text(label, size=size, font="DejaVu Sans Mono:style=Bold", halign="center", valign="center", spacing=spacing, $fn=64);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
8
lib/key_specs.scad
Normal file
8
lib/key_specs.scad
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
// key specifications
|
||||
margin = 1;
|
||||
padding = 1;
|
||||
key_thickness = 2; // + label
|
||||
key_radius = 1;
|
||||
key_width = 9;
|
||||
key_height = 6;
|
||||
mat_thickness = 0.5;
|
||||
8
lib/mat.scad
Normal file
8
lib/mat.scad
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
// genrate key mat that sits under the key caps
|
||||
|
||||
module mat(rows=13, columns=5) {
|
||||
include <key_specs.scad>;
|
||||
$fn = 64;
|
||||
|
||||
color("DarkSlateGray") cube([rows*key_width + (rows-1)*padding + 2*margin, columns*key_height + (columns-1)*padding + 2*margin, mat_thickness]);
|
||||
}
|
||||
Loading…
Reference in a new issue