wip - add matrix transformations
This commit is contained in:
68
rack/connector/basePlateYBarConnectors.scad
Normal file
68
rack/connector/basePlateYBarConnectors.scad
Normal file
@ -0,0 +1,68 @@
|
||||
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 <../sharedVariables.scad>
|
||||
|
||||
include <../config.scad>
|
||||
|
||||
_mountX = 12;
|
||||
_mountY = 14;
|
||||
_mountZ = 10;
|
||||
|
||||
// Needed for yBar to align this connector to its inner Y edge
|
||||
yBarBasePlateConnectorWidth = _mountX;
|
||||
|
||||
// x and y faces of the yBarBasePlateMount_P block
|
||||
_innerXFaceToScrew = 6;
|
||||
_innerYFaceToScrew = 8;
|
||||
|
||||
_baseConnRecession = 3;
|
||||
_baseConnY = 8;
|
||||
_baseConnOuterXFaceToScrew = 2;
|
||||
|
||||
_heatSetX = _mountX - _innerXFaceToScrew;
|
||||
_heatSetY = _mountY - _innerYFaceToScrew;
|
||||
|
||||
// TODO refactor this entire file
|
||||
basePlateScrewMountToYBarXZFace = _heatSetY + joinCornerDepth; // Distance to the nearest YBar XZ face
|
||||
basePlateScrewMountToYBarYZFace = (yBarWidth+_heatSetX) - yBarBasePlateConnectorWidth;
|
||||
|
||||
module onYBarBasePlateConnectorPositive() {
|
||||
translate(v=[0,0,yBarWallThickness])
|
||||
intersection() {
|
||||
cube(size = [_mountX, _mountY, _mountZ]);
|
||||
halfspace(vpos=[0, -1, -1], p=[0, _mountY-1, _mountZ-1]);
|
||||
}
|
||||
}
|
||||
|
||||
module onYBarBasePlateConnectorNegative() {
|
||||
|
||||
translate(v=[_heatSetX, _heatSetY, m3HeatSetInsertSlotHeightSlacked + _baseConnRecession])
|
||||
mirror(v=[0,0,1])
|
||||
heatSetInsertSlot_N(rackFrameScrewType, topExtension=inf10);
|
||||
|
||||
hull() {
|
||||
translate(v = [_heatSetX, _heatSetY, _baseConnRecession+overhangSlack])
|
||||
roundCutSlice(radius = heatSetInsertSlotRadiusSlacked(rackFrameScrewType)+radiusXYSlack);
|
||||
|
||||
translate(v = [_heatSetX, _heatSetY, 0])
|
||||
roundCutSlice(radius = _baseConnY/2 + radiusXYSlack);
|
||||
}
|
||||
|
||||
|
||||
|
||||
module roundCutSlice(radius, length=inf50) {
|
||||
|
||||
hull() {
|
||||
cylinder(r = radius, h = eps);
|
||||
|
||||
translate(v = [length, -radius, 0])
|
||||
cube(size = [eps, radius*2, eps]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,46 +1,77 @@
|
||||
/*
|
||||
Connector factory
|
||||
*/
|
||||
include <../helper/screws.scad>
|
||||
include <../helper/slack.scad>
|
||||
include <../helper/dovetail.scad>
|
||||
include <../helper/halfspace.scad>
|
||||
include <./config.scad>
|
||||
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>
|
||||
|
||||
include <./xBarYBarConnectors.scad>
|
||||
include <./mainRailYBarConnectors.scad>
|
||||
include <./sideModuleYBarConnectors.scad>
|
||||
include <./stackYBarConnectors.scad>
|
||||
include <./basePlateYBarConnectors.scad>
|
||||
|
||||
// WIP
|
||||
|
||||
partList = ["yBar", "xBar", "mainRail", "xyPlate", "sideModule"];
|
||||
|
||||
mirror(v=[1,0,0])
|
||||
*connectorDebug(on="xBar", to="yBar", trans=identity);
|
||||
|
||||
*connectorDebug(on="yBar", to="xBar", trans=identity);
|
||||
|
||||
// Default is to apply the positive first
|
||||
module applyConnector(on,to, trans) {
|
||||
module applyConnector(on, to, trans) {
|
||||
|
||||
//apply_pn() {
|
||||
apply_pn() {
|
||||
multmatrix(trans)
|
||||
connectorPositive(on=on, to=to);
|
||||
|
||||
//}
|
||||
multmatrix(trans)
|
||||
connectorNegative(on=on, to=to);
|
||||
|
||||
children(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
module connectorDebug(on, to, trans) {
|
||||
|
||||
color([0,1,0])
|
||||
multmatrix(trans)
|
||||
connectorPositive(on=on, to=to);
|
||||
|
||||
color([1,0,0])
|
||||
multmatrix(trans)
|
||||
connectorNegative(on=on, to=to);
|
||||
|
||||
}
|
||||
|
||||
|
||||
module applyConnectorDebug(on,to,trans) {
|
||||
|
||||
echo("on: ", on, "-- to:", to);
|
||||
|
||||
apply_p() {
|
||||
multmatrix(trans)
|
||||
connectorDebug(on=on,to=to,trans=trans);
|
||||
|
||||
children(0);
|
||||
}
|
||||
}
|
||||
|
||||
module connectorPositive(on, to) {
|
||||
|
||||
if (on == "yBar" && to == "xBar") {
|
||||
onYBarToXBarPositive();
|
||||
} else if (on == "yBar" && to == "basePlate") {
|
||||
onYBarBasePlateConnectorPositive();
|
||||
} else if (on == "mainRail" && to == "yBar") {
|
||||
onMainRailYBarConnectorPositive();
|
||||
}
|
||||
|
||||
|
||||
module onYBarToXBarPositive() {
|
||||
rotate(a=[0,0,-90])
|
||||
dovetail(
|
||||
topWidth = 15,
|
||||
bottomWidth = 12,
|
||||
height = 2,
|
||||
length = yBarHeight,
|
||||
headExtension = 1,
|
||||
baseExtension = 2,
|
||||
frontFaceLength = 2,
|
||||
frontFaceScale = 0.95,
|
||||
backFaceLength = 5,
|
||||
backFaceScale = 1.2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module connectorNegative(on, to) {
|
||||
@ -51,44 +82,14 @@ module connectorNegative(on, to) {
|
||||
onXBarToYBarNegative();
|
||||
} else if (on == "yBar" && to == "sideModule") {
|
||||
onYBarSideModuleNegative();
|
||||
} else if (on == "yBar" && to == "mainRail") {
|
||||
onYBarToMainRailNegative();
|
||||
} else if (on == "yBar" && to == "stackConnector") {
|
||||
onYBarStackConnectorNegative();
|
||||
} else if (on == "yBar" && to == "basePlate") {
|
||||
onYBarBasePlateConnectorNegative();
|
||||
} else if (on == "mainRail" && to == "yBar") {
|
||||
onMainRailYBarConnectorNegative();
|
||||
}
|
||||
|
||||
|
||||
module onYBarToXBarNegative() {
|
||||
y = 27;
|
||||
z = 6;
|
||||
translate(v = [-m3HeatSetInsertSlotHeightSlacked, y, z])
|
||||
rotate(a = [0, 90, 0])
|
||||
heatSetInsertSlot_N(rackFrameScrewType);
|
||||
|
||||
}
|
||||
|
||||
module onXBarToYBarNegative() {
|
||||
y = 27;
|
||||
z = 6;
|
||||
slack = xySlack;
|
||||
|
||||
translate(v=[-0.5,14,0])
|
||||
mirror(v=[1,0,0])
|
||||
rotate(a=[0,0,-90])
|
||||
dovetail(topWidth = 15+slack, bottomWidth = 12+slack, height = 2+slack, length = yBarHeight,
|
||||
headExtension = 1, baseExtension = 2, frontFaceLength = 0.5, frontFaceScale = 1.05,
|
||||
backFaceLength = 5, backFaceScale = 1.2);
|
||||
|
||||
// TODO clean this up
|
||||
translate(v = [-6, y, z])
|
||||
rotate(a = [0, -90, 0])
|
||||
counterSunkHead_N(rackFrameScrewType, screwExtension=inf10, headExtension=inf10);
|
||||
}
|
||||
|
||||
module onYBarSideModuleNegative() {
|
||||
translate(v = [-xySlack/2, -xySlack/2, -sideWallConnLugDepression])
|
||||
cube(size = [sideWallConnW+xySlack, sideWallConnD+xySlack, sideWallConnLugDepression]);
|
||||
|
||||
translate(v = [yBarScrewHoleToOuterYEdge, yBarScrewHoleToFrontXEdge, -(m3HeatSetInsertSlotHeightSlacked+sideWallConnLugDepression)])
|
||||
heatSetInsertSlot_N(rackFrameScrewType);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
37
rack/connector/mainRailYBarConnectors.scad
Normal file
37
rack/connector/mainRailYBarConnectors.scad
Normal file
@ -0,0 +1,37 @@
|
||||
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 <../sharedVariables.scad>
|
||||
|
||||
include <../config.scad>
|
||||
|
||||
module onYBarToMainRailNegative() {
|
||||
|
||||
slotSlack = xySlack;
|
||||
slotZSlack = zSlack;
|
||||
|
||||
union() {
|
||||
translate(v=[-slotZSlack/2, -slotSlack/2,0])
|
||||
cube(size = [railTotalWidth+slotZSlack, railTotalDepth + slotSlack, railFootThickness]);
|
||||
|
||||
translate(v = [railSideMountThickness + 5, railFrontThickness + 4 , -m3HeatSetInsertSlotHeightSlacked])
|
||||
heatSetInsertSlot_N(rackFrameScrewType);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
module onMainRailYBarConnectorPositive() {
|
||||
|
||||
cube(size = [frontFaceWidth, sideSupportDepth+railFrontThickness, railFootThickness]);
|
||||
}
|
||||
|
||||
|
||||
module onMainRailYBarConnectorNegative() {
|
||||
|
||||
translate(v = [5+railSideMountThickness, 4+railFrontThickness, railFootThickness])
|
||||
counterSunkHead_N(rackFrameScrewType, screwExtension=inf10, headExtension=inf10);
|
||||
}
|
||||
19
rack/connector/sideModuleYBarConnectors.scad
Normal file
19
rack/connector/sideModuleYBarConnectors.scad
Normal file
@ -0,0 +1,19 @@
|
||||
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 <../sharedVariables.scad>
|
||||
|
||||
include <../config.scad>
|
||||
|
||||
module onYBarSideModuleNegative() {
|
||||
|
||||
translate(v = [-xySlack/2, -xySlack/2, -sideWallConnLugDepression])
|
||||
cube(size = [sideWallConnW+xySlack, sideWallConnD+xySlack, sideWallConnLugDepression]);
|
||||
|
||||
translate(v = [yBarScrewHoleToOuterYEdge, yBarScrewHoleToFrontXEdge, -(m3HeatSetInsertSlotHeightSlacked+sideWallConnLugDepression)])
|
||||
heatSetInsertSlot_N(rackFrameScrewType);
|
||||
}
|
||||
128
rack/connector/stackYBarConnectors.scad
Normal file
128
rack/connector/stackYBarConnectors.scad
Normal file
@ -0,0 +1,128 @@
|
||||
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 <../sharedVariables.scad>
|
||||
|
||||
include <../config.scad>
|
||||
|
||||
connectorYEdgeToYBarYEdge = 5;
|
||||
connectorXEdgeToYBarXEdge = 5;
|
||||
|
||||
connectorRectWidth = 10;
|
||||
connectorRectDepth = 10;
|
||||
connectorTotalHeight = 10;
|
||||
connectorSocketMagnetExtrudeHeight = 1;
|
||||
connectorTaperStartHeight = 3;
|
||||
|
||||
connectorTopR = 3;
|
||||
|
||||
connectorRectPlugSlack = -0.2;
|
||||
connectorRectSocketSlack = 0.2;
|
||||
|
||||
connectorBottomToScrew = 6;
|
||||
|
||||
module stackConnectorBase(rectSlack, topSlack=0.0) {
|
||||
|
||||
wSlacked = connectorRectWidth + rectSlack;
|
||||
dSlacked = connectorRectDepth + rectSlack;
|
||||
topRSlacked = connectorTopR + rectSlack/2;
|
||||
|
||||
module connRect() {
|
||||
linear_extrude(height=eps)
|
||||
square(size = [wSlacked, dSlacked]);
|
||||
}
|
||||
|
||||
module connTop() {
|
||||
linear_extrude(height=eps)
|
||||
circle(r=topRSlacked);
|
||||
}
|
||||
|
||||
hull() {
|
||||
connRect();
|
||||
|
||||
translate(v=[0,0,connectorTaperStartHeight])
|
||||
connRect();
|
||||
}
|
||||
|
||||
hull() {
|
||||
translate(v = [0, 0, connectorTaperStartHeight])
|
||||
connRect();
|
||||
|
||||
translate(v=[wSlacked/2, dSlacked/2, connectorTotalHeight+topSlack])
|
||||
connTop();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
module onYBarStackConnectorNegative() {
|
||||
|
||||
wSlacked = connectorRectWidth + connectorRectSocketSlack;
|
||||
dSlacked = connectorRectDepth + connectorRectSocketSlack;
|
||||
|
||||
bevelSlack = 0.6;
|
||||
bevelR = wSlacked + bevelSlack;
|
||||
bevelW = dSlacked + bevelSlack;
|
||||
bevelH = 0.6;
|
||||
|
||||
screwExtension = 4;
|
||||
|
||||
|
||||
union() {
|
||||
stackConnectorBase(connectorRectSocketSlack, topSlack=0.4);
|
||||
|
||||
translate(v = [-screwExtension, connectorRectDepth/2, connectorBottomToScrew])
|
||||
rotate(a = [0, -90, 0])
|
||||
counterSunkHead_N(rackFrameScrewType, screwExtension = 5, headExtension = 10);
|
||||
|
||||
// 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])
|
||||
linear_extrude(height = eps)
|
||||
square(size = [wSlacked, dSlacked]);
|
||||
|
||||
translate(v = [-bevelSlack/2, -bevelSlack/2, 0])
|
||||
linear_extrude(height = eps)
|
||||
square(size = [bevelR, bevelW]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
module stackConnectorPlug() {
|
||||
|
||||
difference() {
|
||||
stackConnectorBase(connectorRectPlugSlack);
|
||||
|
||||
translate(v=[connectorRectWidth/2,connectorRectDepth/2,connectorBottomToScrew])
|
||||
rotate(a=[0,0,90])
|
||||
rotate(a=[90,0,0])
|
||||
hexNutPocket_N(rackFrameScrewType, openSide=false);
|
||||
}
|
||||
}
|
||||
|
||||
module stackConnectorDual() {
|
||||
|
||||
space = 0.5; // extra space inbetween
|
||||
|
||||
translate(v=[0,0,space])
|
||||
stackConnectorPlug();
|
||||
|
||||
mirror(v=[0,0,1])
|
||||
stackConnectorPlug();
|
||||
|
||||
cube(size=[connectorRectWidth+connectorRectPlugSlack, connectorRectDepth+connectorRectPlugSlack, space]);
|
||||
}
|
||||
|
||||
|
||||
module stackConnectorBottom() {
|
||||
|
||||
height = 2; // space between bottom and floor
|
||||
|
||||
stackConnectorPlug();
|
||||
translate(v=[0,0,-height])
|
||||
cube(size=[connectorRectWidth+connectorRectPlugSlack, connectorRectDepth+connectorRectPlugSlack, height]);
|
||||
}
|
||||
10
rack/connector/transformations.scad
Normal file
10
rack/connector/transformations.scad
Normal file
@ -0,0 +1,10 @@
|
||||
// Spatial transformations between various parts' local spaces
|
||||
include <./connectors.scad>
|
||||
|
||||
|
||||
function transform(from, to) =
|
||||
(from == "yBar" && to == "xBar")
|
||||
? identity
|
||||
: (from == "xBar" && to == "yBar")
|
||||
? identity
|
||||
: identity;
|
||||
71
rack/connector/xBarYBarConnectors.scad
Normal file
71
rack/connector/xBarYBarConnectors.scad
Normal file
@ -0,0 +1,71 @@
|
||||
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 <../sharedVariables.scad>
|
||||
|
||||
include <../config.scad>
|
||||
|
||||
// On xBar
|
||||
module onXBarToYBarNegative() {
|
||||
y = 27;
|
||||
z = 6;
|
||||
slack = xBarYBarDovetailSlack;
|
||||
|
||||
translate(v=[-slack,14,0])
|
||||
mirror(v=[1,0,0])
|
||||
rotate(a=[0,0,-90])
|
||||
dovetail(
|
||||
topWidth = 15+slack,
|
||||
bottomWidth = 12+slack,
|
||||
height = 2+slack,
|
||||
length = yBarHeight,
|
||||
headExtension = 1,
|
||||
baseExtension = 2,
|
||||
frontFaceLength = 0.5,
|
||||
frontFaceScale = 1.05,
|
||||
backFaceLength = 5,
|
||||
backFaceScale = 1.2
|
||||
);
|
||||
|
||||
// TODO clean this up
|
||||
translate(v = [-xBarSideThickness, y, z])
|
||||
rotate(a = [0, -90, 0])
|
||||
counterSunkHead_N(rackFrameScrewType, screwExtension=inf10, headExtension=inf10);
|
||||
}
|
||||
|
||||
|
||||
// On yBar
|
||||
module onYBarToXBarNegative() {
|
||||
y = 27;
|
||||
z = 6;
|
||||
translate(v = [-m3HeatSetInsertSlotHeightSlacked, y, z])
|
||||
rotate(a = [0, 90, 0])
|
||||
heatSetInsertSlot_N(rackFrameScrewType);
|
||||
|
||||
}
|
||||
|
||||
module onYBarToXBarPositive() {
|
||||
|
||||
translate(v=[xBarYBarDovetailSlack, 14,0]) // TODO: variable for the 14
|
||||
rotate(a=[0,0,-90])
|
||||
dovetail(
|
||||
topWidth = 15-xySlack, // figure out why we need this
|
||||
bottomWidth = 12,
|
||||
height = 2,
|
||||
length = yBarHeight,
|
||||
headExtension = 1,
|
||||
baseExtension = 2,
|
||||
frontFaceLength = 2,
|
||||
frontFaceScale = 0.95,
|
||||
backFaceLength = 5,
|
||||
backFaceScale = 1.2
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
xBarConnectorToYBarConnectorTrans = mirror(v=[1,0,0]);
|
||||
yBarConnectorToXBarConnectorTrans = mirror(v=[-1,0,0]);
|
||||
Reference in New Issue
Block a user