24 lines
849 B
OpenSCAD
24 lines
849 B
OpenSCAD
// 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() {
|
|
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);
|
|
}
|
|
}
|
|
// TODO: subtract label from key cap
|
|
}
|
|
}
|
|
|