refactor - introduce config folder, and other misc changes

This commit is contained in:
zhao
2023-06-23 21:52:27 -04:00
parent 752b26bff5
commit 02f0155216
86 changed files with 234 additions and 434 deletions

7
config/common.scad Normal file
View File

@ -0,0 +1,7 @@
// Config aggregator
include <./dowel.scad>
include <./magnet.scad>
include <./slack.scad>
include <./printing.scad>
include <./rackFrame.scad>

6
config/dowel.scad Normal file
View File

@ -0,0 +1,6 @@
/*
Dowel pin config used in side wall hinge module and side wall
*/
dowelPinR = 1.5;
dowelPinH = 10;

11
config/magnet.scad Normal file
View File

@ -0,0 +1,11 @@
include <./slack.scad>
// Dimensions for small cylindrical neodymium magnets that I bought off Amazon
magnetR = 3;
magnetH = 1.7;
magnetRSlack = 0.1;
magnetHSlack = 0.05;
magnetRSlacked = magnetR + magnetRSlack;
magnetHSlacked = magnetH + magnetHSlack;

2
config/printing.scad Normal file
View File

@ -0,0 +1,2 @@
defaultLayerHeight = 0.3;

79
config/rackFrame.scad Normal file
View File

@ -0,0 +1,79 @@
// Manually set this variable to toggle rack profile
profileName = "micro";
_profileConfigs = [
["default", [
["maxUnitWidth", 180],
["maxUnitDepth", 180],
["numRailScrews", 18],
["screwDiff", 10],
["mainRailScrewType", "m4"],
["mainRailSideMountScrewType", "m4"],
["rackFrameScrewType", "m3"],
["baseRoundness", 5],
]],
["nano", [
["maxUnitWidth", 105],
["maxUnitDepth", 105],
["numRailScrews", 10]
]],
["micro", [
["maxUnitWidth", 180],
["maxUnitDepth", 180],
["numRailScrews", 18]
]],
["mini", [
["maxUnitWidth", 205],
["maxUnitDepth", 205],
["numRailScrews", 20]
]]
];
function _getConfigValueRaw(profile, varName) = profile[search([varName], profile)[0]][1];
function _getProfileRaw(profileName) = _profileConfigs[search([profileName], _profileConfigs)[0]][1];
function _getConfigValueOrThrowError(val) = val == undef? assert(false, "blah") 0: val;
function _getConfigValueOrDefault(val, default) = val == undef? default: val;
function getConfigValue(profile, varName) =
_getConfigValueOrDefault(
_getConfigValueRaw(profile, varName),
_getConfigValueOrThrowError(_getConfigValueRaw(getProfile("default"), varName))
);
function getProfile(profileName) = _getConfigValueOrThrowError(_getProfileRaw(profileName));
function getConfig(name) = getConfigValue(profile, name);
profile = getProfile(profileName);
// Maximum width for rack-mount units. Change this according your max expected enclosure width.
// Changing this will directly affect the required build volume.
maxUnitWidth = getConfig("maxUnitWidth");
// Maximum (recommended) unit depth. There technically isn't a max unit depth because there's no physical bound on
// how far a rack unit can extrude back. This parameter basically controls the distance between the front of the front
// rails and the back of the back rails. Changing this will directly affect the required build volume.
maxUnitDepth = getConfig("maxUnitDepth");
// Vertical distance between the midpoint of adjacent screws mounts. Affects build volume.
screwDiff = getConfig("screwDiff");
// Number screw slots on the main rail. Affects build volume.
numRailScrews = getConfig("numRailScrews");
// Screw type used for rackmount units. See screws.scad.
mainRailScrewType = getConfig("mainRailScrewType");
// Screw type used to affix side rails.
mainRailSideMountScrewType = getConfig("mainRailSideMountScrewType");
// Screw type used for constructing the actual rack frame.
rackFrameScrewType = getConfig("rackFrameScrewType");
// Currently, only m3 screws are supported here (tolerance issues)
assert(rackFrameScrewType == "m3");
// Fillet radius for main rack profile
baseRoundness = getConfig("baseRoundness");

27
config/slack.scad Normal file
View File

@ -0,0 +1,27 @@
/*
Slack config to standardize different usages of slack/tolerance values.
The purpose of this config is to introduce some consistency with how slack values defined in code. E.g. Why is the
slack value defined as 0.3 in this file, but 0.4 in another? This will also allow model-level adjustments for tighter
fitting parts, for when it might not convenient to adjust the actual 3d printer (using a 3d printer at a makerspace,
for example).
Some important details:
- The general philosophy for slack applications in this project is to subtract space from sockets, while not
modifying the plugs. TODO: enforce this
- Values are signed. Positive values can be interpreted as how much to remove from the socket along some dimension.
- This shouldn't be used to compensate for more serious part shrinkage (> +-0.5mm differences)
*/
xySlack = 0.3;
radiusXYSlack = xySlack/2;
zSlack = 0.2; // TODO figure out nice default value for this. keep in mind z shrinkage
overhangSlack = 0.4;
supportedOverhangSlack = 0.4;
// special slack cases, change if neccessary
xBarYBarDovetailSlack = xySlack;