mirror of
https://github.com/Theaninova/Brick-Monorail.git
synced 2026-01-10 20:12:53 +00:00
feat: switch draft
This commit is contained in:
156
track.json
156
track.json
@@ -1,88 +1,74 @@
|
|||||||
{
|
{
|
||||||
"fileFormatVersion": "1",
|
"fileFormatVersion": "1",
|
||||||
"parameterSets": {
|
"parameterSets": {
|
||||||
"C15": {
|
"C15": {
|
||||||
"Angle": 1,
|
"Angle": "1",
|
||||||
"Length": 15,
|
"Length": "15",
|
||||||
"Radius": 25,
|
"Radius": "25"
|
||||||
"UseLengthForCurveAngle": true,
|
},
|
||||||
"Support": false
|
"C7": {
|
||||||
},
|
"Angle": "1",
|
||||||
"C7": {
|
"Length": "7",
|
||||||
"Angle": 1,
|
"Radius": "25"
|
||||||
"Length": 7,
|
},
|
||||||
"Radius": 25,
|
"S25": {
|
||||||
"UseLengthForCurveAngle": true,
|
"Angle": "0",
|
||||||
"Support": false
|
"Length": "25",
|
||||||
},
|
"Radius": "25"
|
||||||
"S25": {
|
},
|
||||||
"Angle": 0,
|
"S10": {
|
||||||
"Length": 25,
|
"Angle": "0",
|
||||||
"Radius": 25,
|
"Length": "10",
|
||||||
"UseLengthForCurveAngle": true,
|
"Radius": "25"
|
||||||
"Support": false
|
},
|
||||||
},
|
"S5": {
|
||||||
"S10": {
|
"Angle": "0",
|
||||||
"Angle": 0,
|
"Length": "5",
|
||||||
"Length": 10,
|
"Radius": "25"
|
||||||
"Radius": 25,
|
},
|
||||||
"UseLengthForCurveAngle": true,
|
"S4": {
|
||||||
"Support": false
|
"Angle": "0",
|
||||||
},
|
"Length": "4",
|
||||||
"S5": {
|
"Radius": "25"
|
||||||
"Angle": 0,
|
},
|
||||||
"Length": 5,
|
"Classic Full Straight": {
|
||||||
"Radius": 25,
|
"Angle": "0",
|
||||||
"UseLengthForCurveAngle": true,
|
"Length": "32",
|
||||||
"Support": false
|
"Radius": "28"
|
||||||
},
|
},
|
||||||
"S4": {
|
"Classic Half Straight": {
|
||||||
"Angle": 0,
|
"Angle": "0",
|
||||||
"Length": 4,
|
"Length": "16",
|
||||||
"Radius": 25,
|
"Radius": "28"
|
||||||
"UseLengthForCurveAngle": true,
|
},
|
||||||
"Support": false
|
"Classic Quarter Straight": {
|
||||||
},
|
"Angle": "0",
|
||||||
"Classic Full Straight": {
|
"Length": "8",
|
||||||
"Angle": 0,
|
"Radius": "28"
|
||||||
"Length": 32,
|
},
|
||||||
"Radius": 28,
|
"Classic Full Curve": {
|
||||||
"UseLengthForCurveAngle": false,
|
"Angle": "90",
|
||||||
"Support": false
|
"Length": "8",
|
||||||
},
|
"Radius": "28"
|
||||||
"Classic Half Straight": {
|
},
|
||||||
"Angle": 0,
|
"Classic Half Curve": {
|
||||||
"Length": 16,
|
"Angle": "45",
|
||||||
"Radius": 28,
|
"Length": "8",
|
||||||
"UseLengthForCurveAngle": false,
|
"Radius": "28"
|
||||||
"Support": false
|
},
|
||||||
},
|
"StudInsert": {
|
||||||
"Classic Quarter Straight": {
|
"Type": "studs"
|
||||||
"Angle": 0,
|
},
|
||||||
"Length": 8,
|
"AntiStudInsert": {
|
||||||
"Radius": 28,
|
"Type": "antistuds"
|
||||||
"UseLengthForCurveAngle": false,
|
},
|
||||||
"Support": false
|
"New set 1": {
|
||||||
},
|
"Angle": "15",
|
||||||
"Classic Full Curve": {
|
"AntiStudInserts": "false",
|
||||||
"Angle": 90,
|
"Length": "20",
|
||||||
"Length": 8,
|
"Radius": "25",
|
||||||
"Radius": 28,
|
"StudInserts": "false",
|
||||||
"UseLengthForCurveAngle": false,
|
"Type": "switch"
|
||||||
"Support": false
|
}
|
||||||
},
|
|
||||||
"Classic Half Curve": {
|
|
||||||
"Angle": 45,
|
|
||||||
"Length": 8,
|
|
||||||
"Radius": 28,
|
|
||||||
"UseLengthForCurveAngle": false,
|
|
||||||
"Support": false
|
|
||||||
},
|
|
||||||
"StudInsert": {
|
|
||||||
"Type": "studs"
|
|
||||||
},
|
|
||||||
"AntiStudInsert": {
|
|
||||||
"Type": "antistuds"
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
169
track.scad
169
track.scad
@@ -7,15 +7,17 @@ StudInserts = true;
|
|||||||
// Mid-print slot inserts eliminating the need for supports
|
// Mid-print slot inserts eliminating the need for supports
|
||||||
AntiStudInserts = true;
|
AntiStudInserts = true;
|
||||||
// Part to generate
|
// Part to generate
|
||||||
Type = "rail"; // [rail,studs,antistuds]
|
Type = "switch"; // [rail,switch,studs,antistuds]
|
||||||
|
|
||||||
/* [Model Settings] */
|
/* [Model Settings] */
|
||||||
Length = 8; // [4:1:56]
|
Length = 8; // [4:1:56]
|
||||||
// Useful when working with Pythagorean Triples
|
|
||||||
UseLengthForCurveAngle = true;
|
|
||||||
Radius = 25; // [4:1:36]
|
Radius = 25; // [4:1:36]
|
||||||
// The angle the track takes
|
// The angle the track takes
|
||||||
Angle = 0.0;
|
Angle = 0.0;
|
||||||
|
// Useful when working with Pythagorean Triples
|
||||||
|
AngleIsLength = true;
|
||||||
|
SwitchSupportCount = 3;
|
||||||
|
SwitchFrontLength = 4;
|
||||||
|
|
||||||
module __CustomizerLimit__() {}
|
module __CustomizerLimit__() {}
|
||||||
|
|
||||||
@@ -165,46 +167,62 @@ module endCapStraight(includeRail=true) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module monorailCurve(r=28, sa, ea, p1) {
|
module monorailCurve(startCaps=true, endCaps=true, guiderail=true, widthAddRight=0, widthAddLeft=0) {
|
||||||
$n_teeth = round((PI * r * $tile) / (295 / abs(-sa - ea)));
|
sa = 0;
|
||||||
|
ea = AngleIsLength ? asin(Angle / Radius) : Angle;
|
||||||
|
$n_teeth = round((PI * Radius * $tile) / (295 / abs(-sa - ea)));
|
||||||
angle = [180 - ea, 180 + sa];
|
angle = [180 - ea, 180 + sa];
|
||||||
points = arc($n_teeth, r=(r * $tile), angle=angle);
|
points = arc($n_teeth, r=(Radius * $tile), angle=angle);
|
||||||
|
|
||||||
echo(points[0] / $tile);
|
translate([Radius * $tile, 0, 0]) union() {
|
||||||
echo(points[len(points) - 1] / $tile);
|
if (endCaps) {
|
||||||
|
translate(points[0]) rot(180 - ea) back($tile) endCapStraight(includeRail=false);
|
||||||
translate([r * $tile, 0, 0]) union() {
|
}
|
||||||
translate(points[0]) rot(180 - ea) back($tile) endCapStraight(includeRail=false);
|
if (startCaps) {
|
||||||
translate(points[len(points) - 1]) rot(sa) back($tile) endCapStraight(includeRail=false);
|
translate(points[len(points) - 1]) rot(sa) back($tile) endCapStraight(includeRail=false);
|
||||||
|
}
|
||||||
difference() {
|
difference() {
|
||||||
path_sweep([
|
path_sweep(guiderail ? [
|
||||||
[-$teethRailWidth / 2, $tile / 2 + $plate],
|
[-$teethRailWidth / 2, $tile / 2 + $plate],
|
||||||
[-$teethRailWidth / 2, $tile / 2],
|
[-$teethRailWidth / 2, $tile / 2],
|
||||||
[-2 * $tile, $tile / 2],
|
[-(2 + widthAddLeft) * $tile, $tile / 2],
|
||||||
[-2 * $tile, -$tile / 2],
|
[-(2 + widthAddLeft) * $tile, -$tile / 2],
|
||||||
[2 * $tile, -$tile / 2],
|
[(2 + widthAddRight) * $tile, -$tile / 2],
|
||||||
[2 * $tile, $tile / 2],
|
[(2 + widthAddRight) * $tile, $tile / 2],
|
||||||
[$teethRailWidth / 2, $tile / 2],
|
[$teethRailWidth / 2, $tile / 2],
|
||||||
[$teethRailWidth / 2, $tile / 2 + $plate],
|
[$teethRailWidth / 2, $tile / 2 + $plate],
|
||||||
|
] : [
|
||||||
|
[-(2 + widthAddLeft) * $tile, $tile / 2],
|
||||||
|
[-(2 + widthAddLeft) * $tile, -$tile / 2],
|
||||||
|
[(2 + widthAddRight) * $tile, -$tile / 2],
|
||||||
|
[(2 + widthAddRight) * $tile, $tile / 2],
|
||||||
], points);
|
], points);
|
||||||
translate(points[0]) rot(-ea) cube([$tile * 6, $tile * 4, $tile], anchor=CENTER);
|
if (endCaps) {
|
||||||
translate(points[len(points) - 1]) rot(sa) cube([$tile * 6, $tile * 4, $tile], anchor=CENTER);
|
translate(points[0]) rot(-ea) cube([$tile * 8, $tile * 4, $tile], anchor=CENTER);
|
||||||
translate(points[0]) rot(-ea) translate([0, -$teethWidth/2, 0]) cube([$tile * 6, $tile * 4, $tile], anchor=BOTTOM+FRONT);
|
translate(points[0]) rot(-ea) translate([0, -$teethWidth/2, 0]) cube([$tile * 6, $tile * 4, $tile], anchor=BOTTOM+FRONT);
|
||||||
translate(points[len(points) - 1]) rot(sa) translate([0, $teethWidth/2, 0]) cube([$tile * 6, $tile * 4, $tile], anchor=BOTTOM+BACK);
|
}
|
||||||
|
if (startCaps) {
|
||||||
|
translate(points[len(points) - 1]) rot(sa) cube([$tile * 8, $tile * 4, $tile], anchor=CENTER);
|
||||||
|
translate(points[len(points) - 1]) rot(sa) translate([0, $teethWidth / 2, 0]) cube([$tile * 6, $tile * 4, $tile], anchor=BOTTOM+BACK);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (guiderail) {
|
||||||
|
translate([0, 0, $tile / 2])
|
||||||
|
arc_copies($n_teeth + 1, r=(Radius * $tile), sa=angle[0], ea=angle[1] - (180 * ($teethWidth / (PI * Radius * $tile))))
|
||||||
|
tooth();
|
||||||
}
|
}
|
||||||
translate([0, 0, $tile / 2]) arc_copies($n_teeth + 1, r=(r * $tile), sa=angle[0], ea=angle[1] - (180 * ($teethWidth / (PI * r * $tile)))) tooth();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module monorailStraight(l) {
|
module monorailStraight() {
|
||||||
union() {
|
union() {
|
||||||
translate([0, $tile, 0]) endCapStraight();
|
translate([0, $tile, 0]) endCapStraight();
|
||||||
translate([0, (l - 1) * $tile, 0]) rotate(180) endCapStraight();
|
translate([0, (Length - 1) * $tile, 0]) rotate(180) endCapStraight();
|
||||||
if (l > 4) {
|
if (Length > 4) {
|
||||||
translate([0, $tile * 2, 0]) cube([4 * $tile, (l - 4) * $tile, $tile], anchor=FRONT);
|
translate([0, $tile * 2, 0]) cube([4 * $tile, (Length - 4) * $tile, $tile], anchor=FRONT);
|
||||||
translate([0, $tile * 2, $tile / 2]) cube([$teethRailWidth, (l - 4) * $tile, $plate], anchor=BOTTOM+FRONT);
|
translate([0, $tile * 2, $tile / 2]) cube([$teethRailWidth, (Length - 4) * $tile, $plate], anchor=BOTTOM+FRONT);
|
||||||
translate([0, $tile * 2, $tile / 2]) group() {
|
translate([0, $tile * 2, $tile / 2]) group() {
|
||||||
for (i = [0:($teeth * (l - 4) - 1)]) {
|
for (i = [0:($teeth * (Length - 4) - 1)]) {
|
||||||
translate([0, i * $teethWidth, 0]) tooth();
|
translate([0, i * $teethWidth, 0]) tooth();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -212,15 +230,106 @@ module monorailStraight(l) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
module guiderailChainLink() {
|
||||||
|
difference() {
|
||||||
|
tooth();
|
||||||
|
translate([0, $teethWidth / 2, 0]) cyl(d=$LDU * 4, h=$plate, anchor=BOTTOM, $fn=32);
|
||||||
|
}
|
||||||
|
translate([0, $teethWidth / 2 * 3, 0]) cyl(d=$LDU * 3, h=$plate, anchor=BOTTOM, $fn=32);
|
||||||
|
translate([0, $teethWidth / 2, 0]) cube([$teethRailWidth, $teethWidth, $plate], anchor=BOTTOM+FRONT);
|
||||||
|
}
|
||||||
|
|
||||||
|
module switchLeverSlot(travelDistance) {
|
||||||
|
leverHeight = $plate;
|
||||||
|
slotAngle = asin(leverHeight / (travelDistance * $tile));
|
||||||
|
translate([0, $tile / 2, $tile / 2 + $plate])
|
||||||
|
cube([$teethRailWidth / 2, travelDistance * $tile, $plate], anchor=TOP+FRONT);
|
||||||
|
}
|
||||||
|
|
||||||
|
module monorailSwitch() {
|
||||||
|
travelDistance = 2 + ($teethRailWidth / $tile);
|
||||||
|
strength = 4 * $LDU;
|
||||||
|
tolerance = $LDU;
|
||||||
|
|
||||||
|
midLength = ceil(cos(asin(1 - 3 / Radius)) * Radius);
|
||||||
|
|
||||||
|
difference() {
|
||||||
|
union() {
|
||||||
|
translate([0, $tile, 0]) endCapStraight();
|
||||||
|
translate([0, $tile * (Length - 1), 0]) rotate([0, 0, 180]) endCapStraight();
|
||||||
|
translate([0, $tile * SwitchFrontLength, 0]) cube([$tile * 3, $tile * midLength, $tile], anchor=FRONT+RIGHT);
|
||||||
|
translate([0, $tile * SwitchFrontLength, 0]) cube([$tile * 4, $tile * midLength, $tile], anchor=FRONT+CENTER);
|
||||||
|
difference() {
|
||||||
|
translate([0, $tile * SwitchFrontLength, 0]) monorailCurve(startCaps=false, widthAddRight=1);
|
||||||
|
translate([0, $tile * Length, 0]) cube([$tile * 4 + $plate * 2, $tile * 2, $tile], anchor=BACK);
|
||||||
|
}
|
||||||
|
|
||||||
|
// straight teeth
|
||||||
|
translate([-$tile * travelDistance, $tile * SwitchFrontLength, $tile / 2]) group() {
|
||||||
|
cube([$teethRailWidth, $tile * midLength, $plate], anchor=BOTTOM+FRONT);
|
||||||
|
for (i = [0:($teeth * midLength - 1)]) {
|
||||||
|
translate([0, i * $teethWidth, 0]) tooth();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
translate([0, $tile * (midLength + SwitchFrontLength), $tile / 2]) group() {
|
||||||
|
segmentLength = Length - midLength - SwitchFrontLength - 2;
|
||||||
|
cube([$teethRailWidth, $tile * segmentLength, $plate], anchor=BOTTOM+FRONT);
|
||||||
|
cube([$tile * 4, $tile * segmentLength, $tile], anchor=TOP+FRONT);
|
||||||
|
for (i = [0:($teeth * segmentLength - 1)]) {
|
||||||
|
translate([0, i * $teethWidth, 0]) tooth();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
translate([0, $tile * SwitchFrontLength, $tile / 2]) cube([$tile * 20, $teethTolerance, $plate], anchor=BOTTOM);
|
||||||
|
translate([0, $tile * (SwitchFrontLength + midLength), $tile / 2]) cube([$tile * 20, $teethTolerance, $plate], anchor=BOTTOM);
|
||||||
|
translate([0, $tile * SwitchFrontLength, $tile / 2]) cube([$tile * 20, midLength * $tile, $LDU], anchor=BOTTOM+FRONT);
|
||||||
|
|
||||||
|
// Mechanism
|
||||||
|
curveAngleMax = asin((midLength + 0.5 + travelDistance) / Radius);
|
||||||
|
curveAngleMin = asin(midLength / Radius);
|
||||||
|
curveAngle = curveAngleMin + (curveAngleMax - curveAngleMin) / 2;
|
||||||
|
curveX = (1 - cos(curveAngleMin)) * Radius * $tile;
|
||||||
|
translate([0, $tile * (SwitchFrontLength + midLength), 0]) switchLeverSlot(travelDistance);
|
||||||
|
translate([curveX - $LDU, $tile * (SwitchFrontLength + midLength), 0]) rotate([0, 0, -curveAngle]) switchLeverSlot(travelDistance);
|
||||||
|
|
||||||
|
for (i = [0:SwitchSupportCount - 1]) {
|
||||||
|
y = SwitchFrontLength + 1 + ((midLength - 2) / (SwitchSupportCount - 1) * i);
|
||||||
|
wl = 2 * $tile + travelDistance;
|
||||||
|
wr = (1 - cos(asin((y - SwitchFrontLength) / Radius))) * Radius * $tile + travelDistance + 2 * $tile;
|
||||||
|
translate([-wl, $tile * y, 0]) cube([wl + wr, strength, $tile], anchor=FRONT+LEFT);
|
||||||
|
}
|
||||||
|
|
||||||
|
translate([0, $tile * (SwitchFrontLength + midLength / 2), -$tile / 2])
|
||||||
|
cyl(d=$tile * (4 + travelDistance / 2) + $LDU * 2, h=$tile / 2, chamfer=$LDU * 4, $fn=64, anchor=BOTTOM);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*difference() {
|
||||||
|
union() {
|
||||||
|
cube([travelDistance, strength, $tile], anchor=CENTER);
|
||||||
|
cube([4 * $tile + 2 * travelDistance, strength, $tile], anchor=CENTER);
|
||||||
|
rotate([45, 0, 0]) cube([4 * $tile + 2 * travelDistance, strength * 2, strength * 2], anchor=CENTER);
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
|
//cube([4 * $LDU, 120, 4 * $LDU]);
|
||||||
|
//cyl(d=10, h=$LDU * 4, $fn=128, anchor=BOTTOM);
|
||||||
|
}
|
||||||
|
|
||||||
if (Type == "rail") {
|
if (Type == "rail") {
|
||||||
if (Angle == 0)
|
if (Angle == 0)
|
||||||
monorailStraight(l=Length);
|
monorailStraight();
|
||||||
else
|
else
|
||||||
monorailCurve(Radius, sa=0, ea=UseLengthForCurveAngle ? asin(Length / Radius) : Angle);
|
monorailCurve();
|
||||||
} else if (Type == "studs") {
|
} else if (Type == "studs") {
|
||||||
rotate([0, -90, 0]) studInsert();
|
rotate([0, -90, 0]) studInsert();
|
||||||
} else if (Type == "antistuds") {
|
} else if (Type == "antistuds") {
|
||||||
rotate([180, 0, 180]) antiStudInsert();
|
rotate([180, 0, 180]) antiStudInsert();
|
||||||
|
} else if (Type == "switch") {
|
||||||
|
//guiderailChainLink();
|
||||||
|
monorailSwitch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user