78 lines
2.5 KiB
OpenSCAD
78 lines
2.5 KiB
OpenSCAD
$fn=50;
|
|
|
|
include <BOSL/constants.scad>
|
|
use <BOSL/math.scad>
|
|
use <BOSL/transforms.scad>
|
|
|
|
depth = 1;
|
|
plate_depth = 3;
|
|
faceplate_angle = 20;
|
|
|
|
key_u = 19.05; // Width of 1 key unit
|
|
keyswitch_cutout_width = 14; // Width of key switch cutout
|
|
keys = 3; // Number of key switches
|
|
key_width = key_u; // With of a 1u keycap
|
|
key_gap = 2; // Expands the key cutout in each direction
|
|
key_distance = 3; // Spacing between keys
|
|
dial_diameter = 20; // Diameter of the dial, used for spacing
|
|
dial_post_diameter = 7; // Diameter of the post passing through the faceplate
|
|
dial_gap = 2; // Expands the dial cutout in each direction
|
|
dial_distance = 20; // Space between the dial and the keypad
|
|
|
|
faceplate_margin = 10;
|
|
plate_margin = 5;
|
|
|
|
key_cutout_width = key_width + (key_gap * 2);
|
|
keys_width = (key_cutout_width * keys) + (key_distance * (keys - 1));
|
|
faceplate_width = sum([faceplate_margin,
|
|
dial_diameter,
|
|
dial_distance,
|
|
keys_width,
|
|
faceplate_margin]);
|
|
faceplate_interfaceplate_height = max(key_width, dial_diameter);
|
|
faceplate_height = faceplate_interfaceplate_height + (faceplate_margin * 2);
|
|
|
|
module faceplate() {
|
|
|
|
difference() {
|
|
cube([faceplate_width, faceplate_height, depth]);
|
|
|
|
translate([faceplate_margin, faceplate_margin, -1]) {
|
|
translate([dial_diameter / 2,
|
|
dial_diameter / 2,
|
|
0]) {
|
|
cylinder(d=dial_post_diameter + dial_gap, h=depth + 2);
|
|
}
|
|
translate([dial_diameter + dial_distance, 0]) {
|
|
xspread(spacing=key_cutout_width + key_distance, n=keys, sp=[0,0,0]) {
|
|
cube([key_cutout_width, key_cutout_width, depth + 2]);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
module keyswitch_plate() {
|
|
cutout_offset = (key_width - key_cutout_width) / 2;
|
|
difference() {
|
|
plate_width = (plate_margin * 2) + keys_width;
|
|
plate_height = (plate_margin * 2) + key_width;
|
|
cube([plate_width, plate_height, plate_depth]);
|
|
translate([plate_margin - cutout_offset * 2,
|
|
plate_margin - cutout_offset,
|
|
-1]) {
|
|
xspread(spacing=key_cutout_width + key_distance, n=keys, sp=[0,0,0]) {
|
|
cube([keyswitch_cutout_width, keyswitch_cutout_width, plate_depth + 2]);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
rotate([90 - faceplate_angle,0,0]) {
|
|
faceplate();
|
|
translate([faceplate_margin + dial_diameter + dial_distance - plate_margin,
|
|
faceplate_margin - plate_margin,
|
|
6.6])
|
|
color("blue")
|
|
keyswitch_plate();
|
|
}
|