This commit is contained in:
zhao
2023-02-25 13:19:27 -08:00
parent 97a5783d0d
commit 8d3f205f6d
11 changed files with 174 additions and 75 deletions

View File

@ -4,7 +4,7 @@
$fn=64; $fn=64;
// TODO move these to math // TODO move these to math
eps=0.0001; eps=0.00000001;
inf10 = 10; inf10 = 10;
inf50 = 50; inf50 = 50;

44
helper/keystone.scad Normal file
View File

@ -0,0 +1,44 @@
// rj45 slot-to-slot keystone jack model and negative
keystoneMainBodyWidth = 15.0;
keystoneMainBodyHeight = 16.90;
keystoneMainBodyDepth = 32.90;
heightWithHookBody = 20.2;
heightWithHookCatch = 21.30;
widthWithSideLugs = 15.96;
sideLugWidth = (widthWithSideLugs - keystoneMainBodyWidth) / 2.0;
heightWithBottomLug = 17.5;
frontToHookCatch = 8.35;
frontToBottomLugBack = 8.23;
frontToSideLugFront = 10.63;
module rj45Keystone() {
// main keystone body (no hooks or lugs)
cube(size=[keystoneMainBodyWidth, keystoneMainBodyDepth, keystoneMainBodyHeight]);
// slot for top hook
translate(v=[0,frontToHookCatch,0])
cube(size=[keystoneMainBodyWidth, keystoneMainBodyDepth -frontToHookCatch, heightWithHookBody]);
cube(size=[keystoneMainBodyWidth, frontToHookCatch, heightWithHookCatch]);
// slots for side lugs
translate(v=[-sideLugWidth, frontToSideLugFront,0])
cube(size=[widthWithSideLugs, keystoneMainBodyDepth-frontToSideLugFront, keystoneMainBodyHeight]);
// slots for bottom lugs
translate(v=[0,0,-(heightWithBottomLug-keystoneMainBodyHeight)])
cube(size=[keystoneMainBodyWidth, frontToBottomLugBack, keystoneMainBodyHeight]);
}
module rj45KeystoneJack_N() {
translate(v=[0,-4,0.5]) // why?
intersection() {
translate(v=[-2.5,4,-4])
cube(size=[20,6,28]);
rj45Keystone();
}
}

View File

@ -5,26 +5,34 @@ for (i=mirror4XY(midpoint=[0,0,0], offsetX=90, offsetY=90)) {
something(); something();
} }
*/ */
function mirror4XY(midpoint, offsetX, offsetY) =
[[midpoint[0]+offsetX, midpoint[1]+offsetY, midpoint[2]],
[midpoint[0]-offsetX, midpoint[1]+offsetY, midpoint[2]],
[midpoint[0]-offsetX, midpoint[1]-offsetY, midpoint[2]],
[midpoint[0]+offsetX, midpoint[1]-offsetY, midpoint[2]]];
module mirror4XY(p, dx, dy) {
px = p[0];
py = p[1];
translate(v=[px, py, 0])
children(0);
translate(v=[px+dx, py, 0])
children(0);
translate(v=[px, py+dy, 0])
children(0);
translate(v=[px+dx, py+dy, 0])
children(0);
}
module align(a,b) { module align(a,b) {
//echo("a", a);
//echo("b", b);
rot_axis = cross(a,b); rot_axis = cross(a,b);
if (rot_axis == [0,0,0]) { if (rot_axis == [0,0,0]) {
error("Can't align - provided vectors are parallel"); error("Can't align - provided vectors are parallel");
} }
//echo("rot_axis", rot_axis);
angle = acos(a*b/(norm(a)*norm(b))); angle = acos(a*b/(norm(a)*norm(b)));
//echo("angle", angle)
rotate(v=rot_axis, a=angle) rotate(v=rot_axis, a=angle)
children(0); children(0);

22
rack-mount/common.scad Normal file
View File

@ -0,0 +1,22 @@
include <../rack/config.scad>
include <../rack/sharedVariables.scad>
include <../helper/math.scad>
include <../helper/screws.scad>
/*
QoL redefinitions/variables/reimports for rack mount items
*/
uDiff = screwDiff;
// ...

34
rack-mount/plateBase.scad Normal file
View File

@ -0,0 +1,34 @@
include <./common.scad>
module plateBase(U, plateThickness, screwType, screwToXEdge=4, screwToYEdge=4, filletR=2) {
assert(floor(U) == U && U > 0)
assert(plateThickness > 0);
screwDx = rackMountScrewWidth;
screwDy = uDiff * U;
plateLength = screwDx + 2*screwToXEdge;
plateHeight = screwDy + 2*screwToYEdge;
translate(v=[0,0,-plateThickness]) // easier to work with
difference() {
base();
mirror4XY(p=[screwToXEdge, screwToYEdge], dx=screwDx, dy=screwDy)
cylinder(r=screwRadiusSlacked(screwType), h=plateThickness*2, center=true);
}
module base() {
minkowski() {
translate(v=[filletR, filletR, 0])
cube(size = [plateLength-2*filletR, plateHeight-2*filletR, plateThickness]);
cylinder(r=filletR, h=eps);
}
}
}
plateBase(U=2, plateThickness=3, screwType="m4", filletR=2);

View File

@ -0,0 +1,8 @@
include <./common.scad>
module supportRailBase() {
}

View File

@ -15,7 +15,7 @@ echo("Profile:", profile);
function getConfig(name) = getConfigValue(profile, name); function getConfig(name) = getConfigValue(profile, name);
// Maximum width for rackmount units. Change this according your max expected enclosure width. // Maximum width for rack-mount units. Change this according your max expected enclosure width.
// Changing this will directly affect the required build volume. // Changing this will directly affect the required build volume.
maxUnitWidth = getConfig("maxUnitWidth"); maxUnitWidth = getConfig("maxUnitWidth");

View File

@ -6,44 +6,35 @@ include <./sharedVariables.scad>
*mainRail(); *mainRail();
echo("Total Rail Height: ", railTotalHeight);
// Also known as the z-bar :) // Also known as the z-bar :)
module mainRail() { module mainRail() {
mainRail();
module mainRail() {
b = 0.75; // bevel value b = 0.75; // bevel value
intersection() { intersection() {
mainRailSharp(); mainRailSharp();
halfspace(vpos=[1,1,0], p=[b,b,0]); halfspace(vpos=[1,1,0], p=[b,b,0]);
halfspace(vpos=[1,0,1], p=[b,0,b]); halfspace(vpos=[1,0,1], p=[b,0,b]);
halfspace(vpos=[1,0,-1], p=[b,0,railTotalHeight-b]); halfspace(vpos=[1,0,-1], p=[b,0,railTotalHeight-b]);
}
} }
module mainRailSharp() { module mainRailSharp() {
union() { union() {
_frontRailSegment(); frontRailSegment();
translate(v = [railSideMountThickness, railFrontThickness, 0]) translate(v = [railSideMountThickness, railFrontThickness, 0])
rotate(a = [0, 0, 90]) rotate(a = [0, 0, 90])
_sideSupportSegment(); sideSupportSegment();
translate(v = [0, railFrontThickness, 0]) { translate(v = [0, railFrontThickness, 0]) {
translate(v = [railSideMountThickness, 0, 0]) translate(v = [railSideMountThickness, 0, 0])
_railFeet(); railFeet();
translate(v = [railSideMountThickness, 0, railTotalHeight-railFootThickness]) translate(v = [railSideMountThickness, 0, railTotalHeight-railFootThickness])
_railFeet(); railFeet();
} }
} }
} }
module _frontRailSegment() { module frontRailSegment() {
difference() { difference() {
cube(size = [frontFaceWidth, railFrontThickness, railTotalHeight]); cube(size = [frontFaceWidth, railFrontThickness, railTotalHeight]);
@ -55,7 +46,7 @@ module mainRail() {
} }
} }
module _sideSupportSegment() { module sideSupportSegment() {
difference() { difference() {
cube(size = [sideSupportDepth, railSideMountThickness, railTotalHeight]); cube(size = [sideSupportDepth, railSideMountThickness, railTotalHeight]);
@ -67,7 +58,7 @@ module mainRail() {
} }
} }
module _railFeet() { module railFeet() {
difference() { difference() {
cube(size = [frontFaceWidth - railSideMountThickness, sideSupportDepth, railFootThickness]); cube(size = [frontFaceWidth - railSideMountThickness, sideSupportDepth, railFootThickness]);

View File

@ -2,25 +2,23 @@ include <../helper/math.scad>
include <../helper/common.scad> include <../helper/common.scad>
include <../misc/magnet.scad> include <../misc/magnet.scad>
connectorTaperStartHeight = 2;
connectorRectWidth = 10; connectorRectWidth = 10;
connectorRectDepth = 10; connectorRectDepth = 10;
connectorTotalHeight = 5; connectorTotalHeight = 5;
connectorSocketMagnetExtrudeHeight = 1;
connectorTaperStartHeight = 2;
connectorRectPlugSlack = -0.1; connectorRectPlugSlack = -0.1;
connectorRectSocketSlack = 0.1; connectorRectSocketSlack = 0.1;
connectorSocketMagnetExtrudeHeight = 1;
module stackConnectorBase(rectSlack) { module stackConnectorBase(rectSlack) {
_wSlacked = connectorRectWidth + rectSlack; wSlacked = connectorRectWidth + rectSlack;
_dSlacked = connectorRectDepth + rectSlack; dSlacked = connectorRectDepth + rectSlack;
module connRect() { module connRect() {
linear_extrude(height=eps) linear_extrude(height=eps)
square(size = [_wSlacked, _dSlacked]); square(size = [wSlacked, dSlacked]);
} }
module connMagnetMount() { module connMagnetMount() {
@ -39,7 +37,7 @@ module stackConnectorBase(rectSlack) {
translate(v = [0, 0, connectorTaperStartHeight]) translate(v = [0, 0, connectorTaperStartHeight])
connRect(); connRect();
translate(v=[_wSlacked/2, _dSlacked/2, connectorTotalHeight]) translate(v=[wSlacked/2, dSlacked/2, connectorTotalHeight])
connMagnetMount(); connMagnetMount();
} }
} }
@ -47,8 +45,8 @@ module stackConnectorBase(rectSlack) {
module stackConnectorPlug() { module stackConnectorPlug() {
assert(magnetHSlacked > connectorSocketMagnetExtrudeHeight); assert(magnetHSlacked > connectorSocketMagnetExtrudeHeight);
_wSlacked = connectorRectWidth + connectorRectPlugSlack; wSlacked = connectorRectWidth + connectorRectPlugSlack;
_dSlacked = connectorRectDepth + connectorRectPlugSlack; dSlacked = connectorRectDepth + connectorRectPlugSlack;
magnetLevelHeight = connectorTotalHeight - (magnetHSlacked - connectorSocketMagnetExtrudeHeight); magnetLevelHeight = connectorTotalHeight - (magnetHSlacked - connectorSocketMagnetExtrudeHeight);
@ -56,10 +54,10 @@ module stackConnectorPlug() {
intersection() { intersection() {
stackConnectorBase(connectorRectPlugSlack); stackConnectorBase(connectorRectPlugSlack);
cube(size=[_dSlacked, _wSlacked, magnetLevelHeight]); cube(size=[dSlacked, wSlacked, magnetLevelHeight]);
} }
translate(v = [_wSlacked/2, _dSlacked/2, magnetLevelHeight - magnetHSlacked]) translate(v = [wSlacked/2, dSlacked/2, magnetLevelHeight - magnetHSlacked])
cylinder(r = magnetRSlacked, h = magnetHSlacked); cylinder(r = magnetRSlacked, h = magnetHSlacked);
} }
@ -67,45 +65,27 @@ module stackConnectorPlug() {
module stackConnectorSocket_N() { module stackConnectorSocket_N() {
_wSlacked = connectorRectWidth + connectorRectSocketSlack; wSlacked = connectorRectWidth + connectorRectSocketSlack;
_dSlacked = connectorRectDepth + connectorRectSocketSlack; dSlacked = connectorRectDepth + connectorRectSocketSlack;
_bevelSlack = 0.5;
_bevelR = _wSlacked + _bevelSlack;
_bevelW = _dSlacked + _bevelSlack;
_bevelH = 0.5;
bevelSlack = 0.5;
bevelR = wSlacked + bevelSlack;
bevelW = dSlacked + bevelSlack;
bevelH = 0.5;
stackConnectorBase(connectorRectSocketSlack); stackConnectorBase(connectorRectSocketSlack);
translate(v=[_wSlacked/2, _wSlacked/2, connectorTotalHeight - connectorSocketMagnetExtrudeHeight]) translate(v=[wSlacked/2, wSlacked/2, connectorTotalHeight - connectorSocketMagnetExtrudeHeight])
cylinder(r=magnetRSlacked, h=magnetHSlacked); cylinder(r=magnetRSlacked, h=magnetHSlacked);
// bevel at the lip of the socket to guide the plug, as well as mitigate elephant foot during 3d printing // bevel at the lip of the socket to guide the plug, as well as mitigate elephant foot during 3d printing
hull() { hull() {
translate(v=[0,0,_bevelH]) translate(v=[0,0,bevelH])
linear_extrude(height=eps) linear_extrude(height=eps)
square(size = [_wSlacked, _dSlacked]); square(size = [wSlacked, dSlacked]);
translate(v=[-_bevelSlack/2, -_bevelSlack/2, 0]) translate(v=[-bevelSlack/2, -bevelSlack/2, 0])
linear_extrude(height=eps) linear_extrude(height=eps)
square(size = [_bevelR, _bevelW]); square(size = [bevelR, bevelW]);
} }
} }
module test() {
difference() {
union() {
translate(v = [-2.5, -2.5, 0])
cube(size = [15, 15, 10]);
translate(v = [0, 0, 10])
stackConnectorPlug();
}
stackConnectorSocket_N();
}
}
*test();

View File

@ -13,11 +13,6 @@ include <./yBarBasePlateConnector.scad>
include <./side/yBarSideWallConnector.scad> include <./side/yBarSideWallConnector.scad>
include <./sharedVariables.scad> include <./sharedVariables.scad>
echo("Bar total depth: ", yBarDepth);
echo("Bar total width: ", yBarWidth);
echo("Bar total height: ", yBarHeight);
*yBar(); *yBar();
module yBar() { module yBar() {
@ -71,7 +66,11 @@ module yBar() {
module applySideWallConnector() { module applySideWallConnector() {
apply_n() { apply_n() {
mirrorOtherCorner() mirrorOtherCorner()
translate(v = [yBarWidth-(railTotalWidth+railSlotToInnerYEdge+railSlotToSideWallSlot+sideWallConnectorSlotWidth), sideWallSlotToXZ, yBarHeight]) translate(v = [
yBarWidth-(railTotalWidth+railSlotToInnerYEdge+railSlotToSideWallSlot+sideWallConnectorSlotWidth),
sideWallSlotToXZ,
yBarHeight
])
yBarSideWallConnector_N(); yBarSideWallConnector_N();
children(0); children(0);

13
rbuild.py Normal file
View File

@ -0,0 +1,13 @@
import argparse
parser = argparse.ArgumentParser(
prog='rbuild',
description='CLI-based helper utility to build project items',
epilog='That\'s all folks!')
parser.add_argument('build')
#parser.add_argument('-c', '--count') # option that takes a value
#parser.add_argument('-v', '--verbose', action='store_true') # on/off flag
args = parser.parse_args()
print(args.build)