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

View File

@ -1,5 +1,5 @@
include <../helper/math.scad>
include <./config.scad>
include <../helper/common.scad>
include <../config/common.scad>
include <./mainRail.scad>
include <./yBar.scad>
include <./xBar.scad>
@ -12,6 +12,7 @@ include <./xyPlate.scad>
include <../rack-mount/side-rail/dualMount.scad>
// TODO: this is completly broken. fix this and figure out a nice way to run this with cli commands
assemblyInstructions();
module assemblyInstructions () {

View File

@ -1,47 +0,0 @@
/*
case-files v2
This file contains parameters used for declaring/generating a customized rack frame.
- All dimensions are in millimetres (mm) unless stated otherwise.
- "_N" appended to a module is meant to denote that this module is a negative volume, and should only be used to
substract from other volumes. "_P" is meant to denote a positive value. Modules are positive by default.
*/
include <./profiles.scad>
// Manually set this variable to toggle profiles
profileName = "micro";
profile = getProfile(profileName);
defaultLayerHeight = 0.3;
function getConfig(name) = getConfigValue(profile, name);
// 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");

View File

@ -1,14 +1,7 @@
include <../../helper/screws.scad>
include <../../helper/common.scad>
include <../../helper/matrix.scad>
include <../../helper/slack.scad>
include <../../helper/dovetail.scad>
include <../../helper/halfspace.scad>
include <../../config/common.scad>
include <../sharedVariables.scad>
include <../config.scad>
_mountX = 12;
_mountY = 14;
_mountZ = 10;

View File

@ -1,14 +1,7 @@
/*
Connector factory
*/
include <../../helper/screws.scad>
include <../../helper/common.scad>
include <../../helper/matrix.scad>
include <../../helper/slack.scad>
include <../../helper/dovetail.scad>
include <../../helper/halfspace.scad>
include <../config.scad>
// Connector Aggregator and utils
include <../../helper/common.scad>
include <../../config/common.scad>
include <./xBarYBarConnectors.scad>
include <./mainRailYBarConnectors.scad>
include <./sideModuleYBarConnectors.scad>

View File

@ -1,15 +1,7 @@
include <../../helper/screws.scad>
include <../../helper/common.scad>
include <../../helper/matrix.scad>
include <../../helper/halfspace.scad>
include <../../helper/slack.scad>
include <../../helper/dovetail.scad>
include <../../helper/halfspace.scad>
include <../../config/common.scad>
include <../sharedVariables.scad>
include <../config.scad>
mainRailHeatSetOnYBarDx = railSideMountThickness + 5;
mainRailHeatSetOnYBarDy = railFrontThickness + 2;

View File

@ -1,12 +1,7 @@
include <../../helper/screws.scad>
include <../../helper/common.scad>
include <../../helper/matrix.scad>
include <../../helper/slack.scad>
include <../../helper/dovetail.scad>
include <../../helper/halfspace.scad>
include <../../config/common.scad>
include <../sharedVariables.scad>
include <../side/sideWallVariables.scad>
include <../config.scad>
module onYBarSideModuleNegative() {

View File

@ -1,13 +1,7 @@
include <../../helper/screws.scad>
include <../../helper/common.scad>
include <../../helper/matrix.scad>
include <../../helper/slack.scad>
include <../../helper/dovetail.scad>
include <../../helper/halfspace.scad>
include <../../config/common.scad>
include <../sharedVariables.scad>
include <../config.scad>
connectorYEdgeToYBarYEdge = 5;
connectorXEdgeToYBarXEdge = 5;

View File

@ -1,14 +1,7 @@
include <../../helper/screws.scad>
include <../../helper/common.scad>
include <../../helper/matrix.scad>
include <../../helper/slack.scad>
include <../../helper/dovetail.scad>
include <../../helper/halfspace.scad>
include <../../config/common.scad>
include <../sharedVariables.scad>
include <../config.scad>
// On xBar
module onXBarToYBarNegative() {
y = 27;

View File

@ -1,15 +1,9 @@
include <./config.scad>
include <../helper/screws.scad>
include <../helper/filet.scad>
include <../helper/slack.scad>
include <../helper/math.scad>
include <../helper/halfspace.scad>
include <../helper/common.scad>
include <../config/common.scad>
include <./sharedVariables.scad>
include <../helper/matrix.scad>
include <./connector/connectors.scad>
*mainRail();
mainRail();
module mainRail() {

View File

@ -1,6 +1,7 @@
include <../xBar.scad>
include <../yBar.scad>
include <../mainRail.scad>
include <../sharedVariables.scad>
use <../xBar.scad>
use <../yBar.scad>
use <../mainRail.scad>
// Evaluation print for slack config, please see slack.scad
// to configure tolerances

View File

@ -1,4 +1,4 @@
include <../side/hingeModule.scad>
use <../side/hingeModule.scad>
// Oriented for 3d printing.
// Supports generally not required (? need to print to test)

View File

@ -1,4 +1,4 @@
include <../side/magnetModule.scad>
use <../side/magnetModule.scad>
// Oriented for 3d printing.
// Supports generally not required (? need to print to test)

View File

@ -1,4 +1,4 @@
include <../side/magnetModule.scad>
use <../side/magnetModule.scad>
// Oriented for 3d printing.
// Supports generally not required (? need to print to test)

View File

@ -1,11 +1,12 @@
include <../mainRail.scad>
include <../sharedVariables.scad>
use <../mainRail.scad>
// Oriented for 3d printing.
// Supports not required.
multmatrix(mainRailPrintOrientation)
mainRail();
mainRailPrintOrientation = [
[cos(-90), 0, sin(-90), railTotalHeight],
[0, 1, 0, 0 ],

View File

@ -1,4 +1,4 @@
include <../side/sideWallLeft.scad>
use <../side/sideWallLeft.scad>
// Oriented for 3d printing.
// Supports generally not required (? need to print to test), but a brim is recommended

View File

@ -1,4 +1,4 @@
include <../side/sideWallRight.scad>
use <../side/sideWallRight.scad>
// Oriented for 3d printing.
// Supports generally not required (? need to print to test), but a brim is recommended

View File

@ -1,4 +1,4 @@
include <../xBar.scad>
use <../xBar.scad>
// Oriented for 3d printing.
// Supports generally not required: depending on roundness.

View File

@ -1,4 +1,4 @@
include <../xyPlate.scad>
use <../xyPlate.scad>
// Oriented for 3d printing.
// Supports generally not required.

View File

@ -1,16 +1,5 @@
include <../yBar.scad>
include <../xBar.scad>
use <../yBar.scad>
// Oriented for 3d printing.
// Supports required at XY wall connections, and depending on roundness
yBar();
*difference() {
translate(v=[2,0,0])
cube(size=[16,10,6], center=true);
hexNutPocket_N("m3", openSide = false, backSpace = 5, bridgeFront = true);
}
*hexNutPocket_N("m3", openSide = false, backSpace = 5, bridgeBack = true);

View File

@ -1,53 +0,0 @@
/*
case-files v2
This file contains
Example usage:
profileName = "mini";
varName = "mainRailSideMountScrewType";
profile = getProfile(profileName);
echo("val:", getConfigValue(profile, varName));
*/
_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));

View File

@ -1,4 +1,4 @@
include <./config.scad>
include <../config/common.scad>
// Main rail variables:

View File

@ -1,11 +1,10 @@
include <../config.scad>
include <./sideWallVariables.scad>
include <../../helper/common.scad>
include <../../config/common.scad>
include <../sharedVariables.scad>
include <../../helper/halfspace.scad>
include <../../helper/screws.scad>
include <./sideWallVariables.scad>
translate(v=[10,20,-2 - sideWallZHingeTotalClearance])
*hingeModule();
hingeModule();
module hingeModule() {

View File

@ -1,13 +1,10 @@
include <../config.scad>
include <./sideWallVariables.scad>
include <../../helper/common.scad>
include <../../config/common.scad>
include <../sharedVariables.scad>
include <../../helper/halfspace.scad>
include <../../helper/magnet.scad>
include <../../helper/screws.scad>
include <./sideWallVariables.scad>
translate(v=[10,-5,-(2+sideWallZHingeTotalClearance)])
*magnetModule();
magnetModule();
magnetModuleMagnetMountDy = magnetMountToYBarFront - sideWallSlotToXZ;
magnetModuleMagnetMountDz = magnetMountToYBarTop + sideWallConnLugDepression;

View File

@ -1,19 +1,11 @@
include <../../helper/math.scad>
include <../../helper/halfspace.scad>
include <../../helper/magnet.scad>
include <../../helper/slack.scad>
include <../config.scad>
include <../../helper/common.scad>
include <../../config/common.scad>
include <../sharedVariables.scad>
include <./sideWallMagnetMount.scad>
include <./sideWallVariables.scad>
include <../sharedVariables.scad>
include <./magnetModule.scad>
include <./hingeModule.scad>
//echo("Side Wall Height", sideWallZ);
//echo("Side Wall Depth", sideWallY);
//translate(v = [hingePoleDx ,hingePoleDy, 10])
//rotate(a=[0,0,-120])
//translate(v = [-hingePoleDx ,-hingePoleDy, 0])

View File

@ -1,6 +1,6 @@
include <./sideWallBase.scad>
*sideWallLeft();
sideWallLeft();
module sideWallLeft() {

View File

@ -1,9 +1,7 @@
include <../config.scad>
include <./sideWallVariables.scad>
include <../../helper/common.scad>
include <../../config/common.scad>
include <../sharedVariables.scad>
include <../../helper/halfspace.scad>
include <../../helper/magnet.scad>
include <./sideWallVariables.scad>
module sideWallMagnetMount() {
// oriented so that the xy face is the side wall's inner face

View File

@ -1,6 +1,6 @@
include <./sideWallBase.scad>
*sideWallRight();
sideWallRight();
module sideWallRight() {

View File

@ -1,9 +1,6 @@
include <../../helper/common.scad>
include <../../config/common.scad>
include <../config.scad>
include <../sharedVariables.scad>
include <../../helper/magnet.scad>
include <../../helper/slack.scad>
include <../../helper/dowel.scad>
sideWallConnW = 7;
sideWallConnD = 20;

View File

@ -1,5 +1,4 @@
include <../helper/halfspace.scad>
include <../helper/slack.scad>
include <../helper/common.scad>
include <./sharedVariables.scad>
include <./connector/connectors.scad>

View File

@ -1,13 +1,9 @@
include <../helper/cylindricalFilet.scad>
include <../helper/filet.scad>
include <../helper/screws.scad>
include <../helper/matrix.scad>
include <./config.scad>
include <../helper/common.scad>
include <../config/common.scad>
include <./sharedVariables.scad>
include <./connector/connectors.scad>
*xBar();
xBar();
module xBar() {

View File

@ -1,10 +1,7 @@
include <../helper/slack.scad>
include <./yBar.scad>
include <./xBar.scad>
include <../helper/common.scad>
include <./connector/connectors.scad>
*xyPlate();
xyPlate();
xyPlateConnDx = xBarX + 2*_heatSetX; // X distance between connectors
xyPlateConnDy = yBarDepth - 2*basePlateScrewMountToYBarXZFace; // Y distance between connectors

View File

@ -1,16 +1,9 @@
include <../helper/math.scad>
include <../helper/matrix.scad>
include <../helper/sphericalFilet.scad>
include <../helper/cylindricalFilet.scad>
include <../helper/screws.scad>
include <../helper/magnet.scad>
include <./config.scad>
include <./mainRail.scad>
include <../helper/common.scad>
include <../config/common.scad>
include <./connector/connectors.scad>
include <./sharedVariables.scad>
*yBar();
yBar();
module yBar() {