Skip to content

Commit

Permalink
add support "feet" to the switch insert
Browse files Browse the repository at this point in the history
cut out an area for the pcb to sit
  • Loading branch information
b-kelly committed Mar 24, 2021
1 parent a13320d commit ad555e9
Showing 1 changed file with 49 additions and 13 deletions.
62 changes: 49 additions & 13 deletions enclosure.scad
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,20 @@ logoPath = "./Stacks-Icons/src/Icon/Logo.svg";
// whether to fit the logo to the width or to the height
fitLogoToLength = true;

// how deep to imprint the image into the faceplate
imgDepth = 0.24;

// additional height to add to the enclosure to account for electronics, etc
additionalEnclosureHeight = 5;

// pcb dimensions
pcbHeight = 1.6;
pcbWidth = 19.0;
pcbLength = 34.0;

// how much to add/subtract from friction fit parts to give them some "wiggle room"
tolerence = 0.1;

// calculate the size of the enclosure based on the keycap widths
encLength =
(wallWidth * 2) // two walls
Expand Down Expand Up @@ -81,7 +92,7 @@ module post(h)
// if you do, you run the risk of the post breaking off inside the cap (ask me how I know...)

x = postWidth;
y = (postWidth / 4) - 0.2;
y = (postWidth / 4) - tolerence;

xh = x / 2;
yh = y / 2;
Expand All @@ -98,19 +109,20 @@ module post(h)

module microUsbCutout(depth = wallWidth)
{
width = 7.40;
height = 2.40;
width = 7.40 + tolerence;
height = 2.40 + tolerence;

translate([width / -2, 0, 0])
cube([width, depth, height]);
}

module pcb(height = pcbHeight) {
#cube([pcbWidth, pcbLength, height]);
}

module facePlate(includeImage = true)
{
translate([0, wallWidth / 2, 0]) {
translate([0, wallWidth / -2, 0])
#cube([wallWidth / 2, facePlateLength + wallWidth, encHeight]);

difference() {
cube([wallWidth, facePlateLength, encHeight]);

Expand All @@ -119,11 +131,10 @@ module facePlate(includeImage = true)
lengthResize = fitLogoToLength ? facePlateLength - wallWidth : 0;
heightResize = fitLogoToLength ? 0 : encHeight - wallWidth;

imgDepth = 0.5;
translate([imgDepth, facePlateLength / 2, encHeight / 2])
translate([wallWidth - imgDepth, facePlateLength / 2, encHeight / 2])
rotate([90, 0, 90])
resize([lengthResize, heightResize, 0], auto=[true,true,false])
linear_extrude(imgDepth + 1)
linear_extrude(imgDepth)
import(logoPath, center=true);
}
}
Expand All @@ -140,7 +151,10 @@ difference()
translate([wallWidth, wallWidth, wallWidth])
rrect(cornerCurveRadius, encWidth - mod, encLength-mod, encHeight);

pcbHeight = 1.6;
// cutout an area for the pcb to sit, in case it is wider than the curved corners
translate([(encWidth - pcbWidth) / 2, wallWidth, wallWidth])
pcb();

translate([(encWidth / 2), 0, wallWidth + pcbHeight])
microUsbCutout();

Expand Down Expand Up @@ -180,8 +194,30 @@ translate([wallWidth, wallWidth, 0])
if (includeSwitchInsert)
translate([encWidth + 5, 0, 0])
difference() {
mod = wallWidth * 2;
rrect(cornerCurveRadius, encWidth - mod, encLength - mod, 5);
// subtract `tolerence` so it isn't a "flush" fit and will sit inside the enclosure
mod = (wallWidth * 2) - tolerence;
insertHeight = 5;
supportHeight = 9;

union() {
translate([cornerCurveRadius, cornerCurveRadius, 0])
cylinder(supportHeight, r=cornerCurveRadius);

translate([encWidth - cornerCurveRadius - mod, cornerCurveRadius, 0])
cylinder(supportHeight, r=cornerCurveRadius);

translate([cornerCurveRadius, facePlateLength, 0])
cylinder(supportHeight, r=cornerCurveRadius);

translate([encWidth - cornerCurveRadius - mod, encLength - cornerCurveRadius - mod, 0])
cylinder(supportHeight, r=cornerCurveRadius);

rrect(cornerCurveRadius, encWidth - mod, encLength - mod, insertHeight);
}

// make sure to cut out an area for the pcb as well
translate([(encWidth - mod - pcbWidth) / 2, 0, insertHeight])
pcb(supportHeight);

for (i = [0:(columnCount-1)])
{
Expand All @@ -191,7 +227,7 @@ difference() {
y = (keycapWidth * i) + (keycapWidth / 2) + distanceFromWalls + (spaceBetweenCaps * i);

translate([x, y, 0])
cube([switchWidth, switchWidth, 10], center=true);
cube([switchWidth, switchWidth, 100], center=true);
}
}
}
Expand Down

0 comments on commit ad555e9

Please sign in to comment.