Skip to content

Commit

Permalink
add microusb cutout and thin the walls
Browse files Browse the repository at this point in the history
  • Loading branch information
b-kelly committed Mar 20, 2021
1 parent 5fd7a5b commit 9a6c8ae
Showing 1 changed file with 33 additions and 14 deletions.
47 changes: 33 additions & 14 deletions enclosure.scad
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ keyCount = 3;
keycapWidth = 18;
switchHeight = 14;
switchStemHeight = 4;

// post settings
includePosts = false;
postWidth = 4;

// how far apart to space the caps
Expand All @@ -16,7 +19,7 @@ spaceBetweenCaps = 1;
distanceFromWalls = 2;

// how thick the enclosure walls are
wallWidth = 4;
wallWidth = 2;

// calculate the size of the enclosure based on the keycap widths
encWidth =
Expand Down Expand Up @@ -69,6 +72,15 @@ module post(h)
cylinder(h - switchStemHeight, d=reinforcementWidth);
}

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

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

// draw the enclosure
difference()
{
Expand All @@ -87,25 +99,32 @@ difference()
resize([encWidth - mod, 0, 0], auto=[true,true,false])
linear_extrude(imgDepth + 1)
import("./Stacks-Icons/src/Icon/Logo.svg", center=true);

pcbHeight = 1.6;
translate([(encLength / 2), 0, wallWidth + pcbHeight])
microUsbCutout();
}

// simplify the internal math a bit, account for the wall/floor heights
translate([wallWidth, wallWidth, 0])
if (includePosts)
{
for (i = [0:(keyCount-1)])
// simplify the internal math a bit, account for the wall/floor heights
translate([wallWidth, wallWidth, 0])
{
x = distanceFromWalls + (keycapWidth / 2);
y = (keycapWidth * i) + (keycapWidth / 2) + distanceFromWalls + (spaceBetweenCaps * i);
for (i = [0:(keyCount-1)])
{
x = distanceFromWalls + (keycapWidth / 2);
y = (keycapWidth * i) + (keycapWidth / 2) + distanceFromWalls + (spaceBetweenCaps * i);

postHeight =
encHeight // the height of the enclosure
+ switchStemHeight; // the extra height that sticks into the cap
postHeight =
encHeight // the height of the enclosure
+ switchStemHeight; // the extra height that sticks into the cap

translate([x, y, 0])
post(postHeight);
translate([x, y, 0])
post(postHeight);

// add in a dummy keycap for visual debugging purposes
%translate([x - keycapWidth / 2, y - keycapWidth / 2, postHeight - switchStemHeight])
cube([keycapWidth, keycapWidth, switchStemHeight]);
// add in a dummy keycap for visual debugging purposes
%translate([x - keycapWidth / 2, y - keycapWidth / 2, postHeight - switchStemHeight])
cube([keycapWidth, keycapWidth, switchStemHeight]);
}
}
}

0 comments on commit 9a6c8ae

Please sign in to comment.