Design key switch mounting plate

This commit is contained in:
Correl Roush 2023-10-03 15:19:07 -04:00
parent 9a8f1ead41
commit 08c33836a0

View file

@ -5,18 +5,22 @@ use <BOSL/math.scad>
use <BOSL/transforms.scad>
depth = 1;
plate_depth = 3;
faceplate_angle = 20;
keys = 4; // Number of key switches
key_width = 20; // With of a square keycap
key_gap = 2; // Expands the key cutout in each direction
key_distance = 5; // 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
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 = 20;
faceplate_margin = 10;
plate_margin = 5;
key_cutout_width = key_width + (key_gap * 2);
keys_width = (key_cutout_width * keys) + (key_distance * (keys - 1));
@ -48,5 +52,27 @@ module faceplate() {
}
}
rotate([90 - faceplate_angle,0,0])
faceplate();
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();
}