Skip to content

Commit

Permalink
further tweaks to account for user customization
Browse files Browse the repository at this point in the history
  • Loading branch information
b-kelly committed Mar 20, 2021
1 parent 10dc54e commit b223174
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions enclosure.scad
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ cornerCurveRadius = 5;
// the path to the faceplate image
logoPath = "./Stacks-Icons/src/Icon/Logo.svg";

// TODO there's probably a better way to detect and constrain dynamically, but I'm being lazy here
// whether to fit the logo to the width or to the height
fitLogoToLength = true;

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

// calculate the size of the enclosure based on the keycap widths
encLength =
(wallWidth * 2) // two walls
Expand All @@ -45,7 +52,7 @@ encWidth =
+ (spaceBetweenCaps * (rowCount - 1)) // the space between each key, not including the end keys
+ (distanceFromWalls * 2); // distance between the walls and the cap

encHeight = switchHeight + wallWidth;
encHeight = switchHeight + wallWidth + additionalEnclosureHeight;

facePlateLength = encLength - (wallWidth * 2) - cornerCurveRadius;

Expand Down Expand Up @@ -108,10 +115,13 @@ module facePlate(includeImage = true)

if (includeImage)
{
lengthResize = fitLogoToLength ? facePlateLength - wallWidth : 0;
heightResize = fitLogoToLength ? 0 : encHeight - wallWidth;

imgDepth = 0.5;
translate([imgDepth, facePlateLength / 2, encHeight / 2])
rotate([90, 0, 90])
resize([0, encHeight - wallWidth, 0], auto=[true,true,false])
resize([lengthResize, heightResize, 0], auto=[true,true,false])
linear_extrude(imgDepth + 1)
import(logoPath, center=true);
}
Expand Down

0 comments on commit b223174

Please sign in to comment.