Design enclosure faceplate

This commit is contained in:
Correl Roush 2023-10-02 01:12:00 -04:00
parent 8e7dec24ba
commit 9a8f1ead41

52
openscad/enclosure.scad Normal file
View file

@ -0,0 +1,52 @@
$fn=50;
include <BOSL/constants.scad>
use <BOSL/math.scad>
use <BOSL/transforms.scad>
depth = 1;
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
faceplate_margin = 20;
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]);
}
}
}
}
}
rotate([90 - faceplate_angle,0,0])
faceplate();