Use a baseplate rather than a faceplate

This commit is contained in:
Correl Roush 2023-10-03 20:12:00 -04:00
parent 08c33836a0
commit 3f5c04d892

View file

@ -1,78 +1,56 @@
$fn=50;
include <BOSL/constants.scad>
use <BOSL/math.scad>
use <BOSL/transforms.scad>
depth = 1;
plate_depth = 3;
faceplate_angle = 20;
$fn = $preview ? 30 : 50;
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;
plate_thickness = 1.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);
// Number of key switches
keys = 3;
// Spacing between keys
key_distance = 0;
// With of a 1u keycap
key_width = 19.05;
// Width of key switch cutout
keyswitch_cutout_width = 14;
module faceplate() {
// Diameter of the dial, used for spacing
dial_diameter = 20;
dial_base_width = 12.85;
dial_base_height = 16.75;
// Space between the dial and the keypad
dial_distance = 5;
keys_width = (key_width * keys) + (key_distance * (keys - 1));
keys_height = key_width;
module support_plate() {
difference() {
cube([faceplate_width, faceplate_height, depth]);
keyswitch_cutout_offset = (key_width - keyswitch_cutout_width) / 2;
dial_cutout_offset_x = (dial_diameter - dial_base_width) / 2;
dial_cutout_offset_y = (dial_diameter - dial_base_height) / 2;
plate_width = (plate_margin * 2) + dial_diameter + dial_distance + keys_width;
plate_height = (plate_margin * 2) + max(dial_diameter, key_width);
cube([plate_width, plate_height, plate_thickness]);
translate([plate_margin, plate_margin, -1]) {
// Dial cutouts
translate([(dial_diameter - dial_base_width) / 2,
(dial_diameter - dial_base_height) / 2])
cube([dial_base_width, dial_base_height, plate_thickness + 2]);
translate([faceplate_margin, faceplate_margin, -1]) {
translate([dial_diameter / 2,
dial_diameter / 2,
0]) {
cylinder(d=dial_post_diameter + dial_gap, h=depth + 2);
// Key switch cutouts
offset_y = dial_diameter <= key_width ? 0 : (dial_diameter - key_width) / 2;
translate([dial_diameter + dial_distance, offset_y]) {
translate([keyswitch_cutout_offset, keyswitch_cutout_offset + offset_y]) {
xspread(spacing=key_width + key_distance, n=keys, sp=[0,0,0]) {
cube([keyswitch_cutout_width, keyswitch_cutout_width, plate_thickness + 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();
}
support_plate();