mirror of
https://github.com/Theaninova/Brick-Monorail.git
synced 2025-12-12 12:46:13 +00:00
feat: improvements
This commit is contained in:
26
README.md
26
README.md
@@ -5,18 +5,20 @@ Parametric Lego-compatible monorail tracks, designed specifically for 3d printin
|
|||||||
Since the parts are made parametric, you can have any length or curve radius you want,
|
Since the parts are made parametric, you can have any length or curve radius you want,
|
||||||
but these are the original tracks you can replicate
|
but these are the original tracks you can replicate
|
||||||
|
|
||||||
| Lego Name | Parameters |
|
| Common Name | Supported | Material Cost | Print Time |
|
||||||
| ----------------- | ------------------------ |
|
| ------------------- | --------- | ------------- | ---------- |
|
||||||
| Straight Long | `monorailStraight(l=32)` |
|
| Straight Long/Full | ✓ | | |
|
||||||
| Straight Short | `monorailStraight(l=8)` |
|
| Straight Short/Half | ✓ | | |
|
||||||
| Curve Long | `monorailCurve90(r=28)` |
|
| Straight Quarter | ✓ | | |
|
||||||
| Curve Short Left | ❌ |
|
| Straight 4-studs | ✓ | ~10ct | 15m |
|
||||||
| Curve Short Right | ❌ |
|
| Curve Long | ✓ | | |
|
||||||
| Ramp Upper Part | ❌ |
|
| Curve Short Left | ❌ | | |
|
||||||
| Ramp Lower Part | ❌ |
|
| Curve Short Right | ❌ | | |
|
||||||
| Monoswitch | ❌ |
|
| Ramp Upper Part | ❌ | | |
|
||||||
| Point Right | ❌ |
|
| Ramp Lower Part | ❌ | | |
|
||||||
| Point Left | ❌ |
|
| Monoswitch | ❌ | | |
|
||||||
|
| Point Right | ❌ | | |
|
||||||
|
| Point Left | ❌ | | |
|
||||||
|
|
||||||
## Design differences
|
## Design differences
|
||||||
|
|
||||||
|
|||||||
116
track.scad
116
track.scad
@@ -1,15 +1,19 @@
|
|||||||
include <BOSL2/std.scad>;
|
include <BOSL2/std.scad>;
|
||||||
include <BOSL2/beziers.scad>;
|
include <BOSL2/beziers.scad>;
|
||||||
|
|
||||||
Type="straight"; // [straight, curve]
|
// Enable built-in support for 3d printing
|
||||||
|
Support=true;
|
||||||
|
// Supports are generated with respect to the layer height
|
||||||
|
LayerHeight=0.2; // [0.05,0.1,0.2]
|
||||||
|
|
||||||
// Only applies to straight tracks
|
// Only applies to straight tracks
|
||||||
Length=8; // [4:1:56]
|
Length=8; // [4:1:56]
|
||||||
// Only applies to curves
|
// Only applies to curves
|
||||||
Radius=28; // [4:1:36]
|
Radius=28; // [4:1:36]
|
||||||
// The angle at which the curve starts
|
// The angle at the y- axis
|
||||||
StartAngle=0; // [0:15:360]
|
StartAngle=45; // [0:15:90]
|
||||||
// The angle at which the curve ends
|
// The angle at the y+ axis
|
||||||
EndAngle=45; // [0:15:360]
|
EndAngle=0; // [0:15:90]
|
||||||
|
|
||||||
module __CustomizerLimit__() {}
|
module __CustomizerLimit__() {}
|
||||||
|
|
||||||
@@ -65,23 +69,26 @@ module brickSlot(w=1, l=1, h=3) {
|
|||||||
cube([$stud, $stud, $studHeight * 2], anchor=BOTTOM);
|
cube([$stud, $stud, $studHeight * 2], anchor=BOTTOM);
|
||||||
}
|
}
|
||||||
|
|
||||||
module endCapStraight() {
|
module endCapStraight(includeRail=true) {
|
||||||
$width = $baseWidth - $plate * 2;
|
$width = $baseWidth - $plate * 2;
|
||||||
union() {
|
union() {
|
||||||
difference() {
|
difference() {
|
||||||
union() {
|
union() {
|
||||||
cube([$width, $tile * 2, $tile], anchor=CENTER);
|
cube([$width, $tile * 2, $tile], anchor=CENTER);
|
||||||
difference() {
|
mirror_copy([0, 1, 0])
|
||||||
mirror_copy([0, 1, 0])
|
translate([0, $tile / 2, 0])
|
||||||
translate([0, $tile / 2, 0])
|
cyl(l=$width + $studHeight * 2 + $LDU / 2, d=$stud, orient=LEFT, $fn=24);
|
||||||
cyl(l=$width + $studHeight * 2 + $LDU / 2, d=$stud + $LDU, orient=LEFT, $fn=24);
|
|
||||||
mirror_copy([1, 0, 0])
|
|
||||||
translate([$tile * 2, 0, -$stud / 2 - 0.2])
|
|
||||||
rotate([0, -7, 0])
|
|
||||||
cube([$studHeight * 10, $tile * 4, $LDU], anchor=BOTTOM+RIGHT);
|
|
||||||
}
|
|
||||||
|
|
||||||
translate([$tile, -$tile, 0]) cube([8 * $LDU, $LDU, $tile], anchor=LEFT+BACK);
|
translate([$tile, -$tile, 0]) cube([8 * $LDU, $LDU, $tile], anchor=LEFT+BACK);
|
||||||
|
|
||||||
|
if (Support) {
|
||||||
|
mirror_copy([1, 0, 0]) difference() {
|
||||||
|
translate([$tile * 2 - $studHeight, 0, -$tile / 2]) cube([$LDU * 3, $tile * 2 - $LDU - 2, $LDU * 6], anchor=BOTTOM+RIGHT);
|
||||||
|
mirror_copy([0, 1, 0])
|
||||||
|
translate([0, $tile / 2, 0])
|
||||||
|
cyl(l=$width + $studHeight * 2 + $LDU / 2, d=$stud + LayerHeight * 2, orient=LEFT, $fn=24);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Brick slots
|
// Brick slots
|
||||||
mirror_copy([1, 0, 0])
|
mirror_copy([1, 0, 0])
|
||||||
@@ -106,53 +113,41 @@ module endCapStraight() {
|
|||||||
cyl(d=$fillet, h=$tile, $fn=12);
|
cyl(d=$fillet, h=$tile, $fn=12);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Rail
|
if (includeRail) {
|
||||||
translate([0, $teethTolerance / 2, $tile / 2]) cuboid([$teethRailWidth, $tile * 2 - $teethTolerance, $plate], anchor=BOTTOM);
|
// Rail
|
||||||
translate([0, -$tile, $tile / 2]) group() {
|
translate([0, $teethTolerance / 2, $tile / 2]) cuboid([$teethRailWidth, $tile * 2 - $teethTolerance, $plate], anchor=BOTTOM);
|
||||||
for (i = [0:(2 * $teeth - 1)]) {
|
translate([0, -$tile, $tile / 2]) group() {
|
||||||
translate([0, i * $teethWidth, 0]) tooth();
|
for (i = [0:(2 * $teeth - 1)]) {
|
||||||
}
|
translate([0, i * $teethWidth, 0]) tooth();
|
||||||
};
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module monorailCurve(p0, p1, p2, resolution=512) {
|
module monorailCurve(r=28, sa, ea, p1) {
|
||||||
union() {
|
$n_teeth = round((PI * r * $tile) / (360 / abs(-sa - ea)));
|
||||||
/*translate([r * $tile, $tile, 0]) endCapStraight();
|
angle = [180 - ea, 180 + sa];
|
||||||
translate([$tile, r * $tile, 0]) rotate(-90) endCapStraight();
|
points = arc($n_teeth, r=(r * $tile), angle=angle);
|
||||||
|
|
||||||
$radius = (r - 2) * $tile;*/
|
translate([r * $tile, 0, 0]) union() {
|
||||||
|
translate(points[0]) rot(180 - ea) back($tile) endCapStraight(includeRail=false);
|
||||||
bez = [p0, p1, p2];
|
translate(points[len(points) - 1]) rot(sa) back($tile) endCapStraight(includeRail=false);
|
||||||
debug_bezier(bez, N=len(bez)-1);
|
difference() {
|
||||||
$n_teeth = round(bezier_length(bez) / $tile * $teeth);
|
path_sweep([
|
||||||
echo($n_teeth);
|
[-$teethRailWidth / 2, $tile / 2 + $plate],
|
||||||
$points = bezier_curve(bez, $n_teeth);
|
[-$teethRailWidth / 2, $tile / 2],
|
||||||
|
[-2 * $tile, $tile / 2],
|
||||||
translate($points[0]) rot(from=[0, 1, 0], to=bezier_tangent(bez, 0)) fwd($tile) endCapStraight();
|
[-2 * $tile, -$tile / 2],
|
||||||
translate($points[len($points) - 1]) rot(from=[0, -1, 0], to=bezier_tangent(bez, 1)) fwd($tile) endCapStraight();
|
[2 * $tile, -$tile / 2],
|
||||||
path_sweep([
|
[2 * $tile, $tile / 2],
|
||||||
[-$teethRailWidth / 2, $tile / 2 + $plate],
|
[$teethRailWidth / 2, $tile / 2],
|
||||||
[-$teethRailWidth / 2, $tile / 2],
|
[$teethRailWidth / 2, $tile / 2 + $plate],
|
||||||
[-2 * $tile, $tile / 2],
|
], points);
|
||||||
[-2 * $tile, -$tile / 2],
|
translate(points[0]) rot(-ea) cube([$tile * 6, $tile * 4, $tile], anchor=CENTER);
|
||||||
[2 * $tile, -$tile / 2],
|
translate(points[len(points) - 1]) rot(sa) cube([$tile * 6, $tile * 4, $tile], anchor=CENTER);
|
||||||
[2 * $tile, $tile / 2],
|
|
||||||
[$teethRailWidth / 2, $tile / 2],
|
|
||||||
[$teethRailWidth / 2, $tile / 2 + $plate],
|
|
||||||
], $points, tangent=bezier_tangent(bez, [0:1/$n_teeth:1]));
|
|
||||||
translate([0, 0, $tile / 2]) path_copies($points, n=$n_teeth) rotate([-90, 90, 0]) tooth();
|
|
||||||
|
|
||||||
//extrude_2d_shapes_along_bezier(path) square([4 * $tile, $tile]);
|
|
||||||
|
|
||||||
/*translate([2 * $tile, 2 * $tile]) intersection() {
|
|
||||||
arced_slot(r=$radius, h=$tile, sd=4 * $tile, sa=sa, ea=ea, $fn=resolution);
|
|
||||||
}
|
}
|
||||||
translate([2 * $tile, 2 * $tile, $tile / 2])
|
translate([0, 0, $tile / 2]) arc_copies($n_teeth, r=(r * $tile), sa=angle[0], ea=angle[1]) tooth();
|
||||||
arced_slot($radius, h=$plate, sd=$teethRailWidth, align=V_TOP, sa=sa, ea=ea, $fn=resolution);
|
|
||||||
translate([2 * $tile, 2 * $tile, $tile / 2])
|
|
||||||
arc_of(n = round(((PI * $radius) / (180 / (ea - sa))) / $tile * $teeth), r=(r - 2) * $tile, rot=true, sa=sa, ea=ea, $fn=resolution)
|
|
||||||
tooth();*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -172,10 +167,11 @@ module monorailStraight(l) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Type == "straight")
|
if (EndAngle == 0 && StartAngle == 0)
|
||||||
monorailStraight(l=Length);
|
monorailStraight(l=Length);
|
||||||
else if (Type == "curve")
|
else
|
||||||
monorailCurve(p0=[0, 0, 0], p1=[5, 40, 0], p2=[80, 80, 0]);
|
monorailCurve(Radius, sa=StartAngle, ea=EndAngle);
|
||||||
|
|
||||||
// endCapStraight();
|
// endCapStraight();
|
||||||
// translate([28.75, -232, -5.75]) rotate([0, 0, 90]) import("straight.stl");
|
// translate([28.75, -232, -5.75]) rotate([0, 0, 90]) import("straight.stl");
|
||||||
|
//translate([28.75, -232, -5.75]) rotate([0, 0, 90]) import("4dbrix_curve.stl");
|
||||||
|
|||||||
Reference in New Issue
Block a user