diff --git a/helper/common.scad b/helper/common.scad index 81298f8..7c9714d 100644 --- a/helper/common.scad +++ b/helper/common.scad @@ -4,7 +4,7 @@ $fn=64; // TODO move these to math -eps=0.0001; +eps=0.00000001; inf10 = 10; inf50 = 50; diff --git a/helper/keystone.scad b/helper/keystone.scad new file mode 100644 index 0000000..f860adc --- /dev/null +++ b/helper/keystone.scad @@ -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(); + } +} diff --git a/helper/math.scad b/helper/math.scad index 6413a20..dbb8953 100644 --- a/helper/math.scad +++ b/helper/math.scad @@ -5,26 +5,34 @@ for (i=mirror4XY(midpoint=[0,0,0], offsetX=90, offsetY=90)) { 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) { - //echo("a", a); - //echo("b", b); + rot_axis = cross(a,b); if (rot_axis == [0,0,0]) { error("Can't align - provided vectors are parallel"); } - //echo("rot_axis", rot_axis); - angle = acos(a*b/(norm(a)*norm(b))); - //echo("angle", angle) rotate(v=rot_axis, a=angle) children(0); diff --git a/rack-mount/common.scad b/rack-mount/common.scad new file mode 100644 index 0000000..2f3edbb --- /dev/null +++ b/rack-mount/common.scad @@ -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; + +// ... + + + + + + + + + diff --git a/rack-mount/plateBase.scad b/rack-mount/plateBase.scad new file mode 100644 index 0000000..5124348 --- /dev/null +++ b/rack-mount/plateBase.scad @@ -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); \ No newline at end of file diff --git a/rack-mount/supportRailBase.scad b/rack-mount/supportRailBase.scad new file mode 100644 index 0000000..835dd6f --- /dev/null +++ b/rack-mount/supportRailBase.scad @@ -0,0 +1,8 @@ +include <./common.scad> + + +module supportRailBase() { + + + +} \ No newline at end of file diff --git a/rack/config.scad b/rack/config.scad index 8d87cc2..122ef15 100644 --- a/rack/config.scad +++ b/rack/config.scad @@ -15,7 +15,7 @@ echo("Profile:", profile); 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. maxUnitWidth = getConfig("maxUnitWidth"); diff --git a/rack/mainRail.scad b/rack/mainRail.scad index 1ce49e0..4833a11 100644 --- a/rack/mainRail.scad +++ b/rack/mainRail.scad @@ -6,44 +6,35 @@ include <./sharedVariables.scad> *mainRail(); -echo("Total Rail Height: ", railTotalHeight); - // Also known as the z-bar :) module mainRail() { - mainRail(); - - module mainRail() { b = 0.75; // bevel value intersection() { mainRailSharp(); 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,railTotalHeight-b]); - } - } module mainRailSharp() { union() { - _frontRailSegment(); + frontRailSegment(); translate(v = [railSideMountThickness, railFrontThickness, 0]) rotate(a = [0, 0, 90]) - _sideSupportSegment(); + sideSupportSegment(); translate(v = [0, railFrontThickness, 0]) { - translate(v = [railSideMountThickness, 0, 0]) - _railFeet(); - + railFeet(); translate(v = [railSideMountThickness, 0, railTotalHeight-railFootThickness]) - _railFeet(); + railFeet(); } } } - module _frontRailSegment() { + module frontRailSegment() { difference() { cube(size = [frontFaceWidth, railFrontThickness, railTotalHeight]); @@ -55,7 +46,7 @@ module mainRail() { } } - module _sideSupportSegment() { + module sideSupportSegment() { difference() { cube(size = [sideSupportDepth, railSideMountThickness, railTotalHeight]); @@ -67,7 +58,7 @@ module mainRail() { } } - module _railFeet() { + module railFeet() { difference() { cube(size = [frontFaceWidth - railSideMountThickness, sideSupportDepth, railFootThickness]); diff --git a/rack/stackConnector.scad b/rack/stackConnector.scad index 6263efc..9a5ee9f 100644 --- a/rack/stackConnector.scad +++ b/rack/stackConnector.scad @@ -2,25 +2,23 @@ include <../helper/math.scad> include <../helper/common.scad> include <../misc/magnet.scad> -connectorTaperStartHeight = 2; connectorRectWidth = 10; connectorRectDepth = 10; - connectorTotalHeight = 5; +connectorSocketMagnetExtrudeHeight = 1; +connectorTaperStartHeight = 2; connectorRectPlugSlack = -0.1; connectorRectSocketSlack = 0.1; -connectorSocketMagnetExtrudeHeight = 1; - module stackConnectorBase(rectSlack) { - _wSlacked = connectorRectWidth + rectSlack; - _dSlacked = connectorRectDepth + rectSlack; + wSlacked = connectorRectWidth + rectSlack; + dSlacked = connectorRectDepth + rectSlack; module connRect() { linear_extrude(height=eps) - square(size = [_wSlacked, _dSlacked]); + square(size = [wSlacked, dSlacked]); } module connMagnetMount() { @@ -39,7 +37,7 @@ module stackConnectorBase(rectSlack) { translate(v = [0, 0, connectorTaperStartHeight]) connRect(); - translate(v=[_wSlacked/2, _dSlacked/2, connectorTotalHeight]) + translate(v=[wSlacked/2, dSlacked/2, connectorTotalHeight]) connMagnetMount(); } } @@ -47,8 +45,8 @@ module stackConnectorBase(rectSlack) { module stackConnectorPlug() { assert(magnetHSlacked > connectorSocketMagnetExtrudeHeight); - _wSlacked = connectorRectWidth + connectorRectPlugSlack; - _dSlacked = connectorRectDepth + connectorRectPlugSlack; + wSlacked = connectorRectWidth + connectorRectPlugSlack; + dSlacked = connectorRectDepth + connectorRectPlugSlack; magnetLevelHeight = connectorTotalHeight - (magnetHSlacked - connectorSocketMagnetExtrudeHeight); @@ -56,10 +54,10 @@ module stackConnectorPlug() { intersection() { 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); } @@ -67,45 +65,27 @@ module stackConnectorPlug() { module stackConnectorSocket_N() { - _wSlacked = connectorRectWidth + connectorRectSocketSlack; - _dSlacked = connectorRectDepth + connectorRectSocketSlack; - - _bevelSlack = 0.5; - _bevelR = _wSlacked + _bevelSlack; - _bevelW = _dSlacked + _bevelSlack; - _bevelH = 0.5; + wSlacked = connectorRectWidth + connectorRectSocketSlack; + dSlacked = connectorRectDepth + connectorRectSocketSlack; + bevelSlack = 0.5; + bevelR = wSlacked + bevelSlack; + bevelW = dSlacked + bevelSlack; + bevelH = 0.5; stackConnectorBase(connectorRectSocketSlack); - translate(v=[_wSlacked/2, _wSlacked/2, connectorTotalHeight - connectorSocketMagnetExtrudeHeight]) + translate(v=[wSlacked/2, wSlacked/2, connectorTotalHeight - connectorSocketMagnetExtrudeHeight]) 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 hull() { - translate(v=[0,0,_bevelH]) + translate(v=[0,0,bevelH]) 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) - 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(); - diff --git a/rack/yBar.scad b/rack/yBar.scad index 0a23e5e..d7b0026 100644 --- a/rack/yBar.scad +++ b/rack/yBar.scad @@ -13,11 +13,6 @@ include <./yBarBasePlateConnector.scad> include <./side/yBarSideWallConnector.scad> include <./sharedVariables.scad> - -echo("Bar total depth: ", yBarDepth); -echo("Bar total width: ", yBarWidth); -echo("Bar total height: ", yBarHeight); - *yBar(); module yBar() { @@ -71,7 +66,11 @@ module yBar() { module applySideWallConnector() { apply_n() { mirrorOtherCorner() - translate(v = [yBarWidth-(railTotalWidth+railSlotToInnerYEdge+railSlotToSideWallSlot+sideWallConnectorSlotWidth), sideWallSlotToXZ, yBarHeight]) + translate(v = [ + yBarWidth-(railTotalWidth+railSlotToInnerYEdge+railSlotToSideWallSlot+sideWallConnectorSlotWidth), + sideWallSlotToXZ, + yBarHeight + ]) yBarSideWallConnector_N(); children(0); diff --git a/rbuild.py b/rbuild.py new file mode 100644 index 0000000..0787125 --- /dev/null +++ b/rbuild.py @@ -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)