Move tracks to modules, add Makefile

This commit is contained in:
Stefan Thoss
2025-01-14 21:27:48 -08:00
parent 28b42bc524
commit 6c34a098b7
5 changed files with 121 additions and 71 deletions
+14
View File
@@ -0,0 +1,14 @@
SCAD=train_tracks_generator.scad
SUFFIX=.stl
# match "module foobar() { // `make` me"
TARGETS != sed -n 's/^module *\([A-Za-z0-9_-]*\)() *.*make.* me.*$$/\1$(SUFFIX)/p' $(SCAD)
$(shell mkdir -p output)
all: ${TARGETS}
.SUFFIXES: ${SUFFIX}
${TARGETS}: $(SCAD)
echo 'use <$(SCAD)>;\n$*();' | openscad -m make -o output/$@ -
+3 -3
View File
@@ -1,9 +1,9 @@
## Installation ## Brio Track Generation
```shell ```shell
ln -s train_tracks_generator.scad ~/.local/share/OpenSCAD/libraries/train_tracks_generator.scad make
``` ```
## License ## License
`train_tracks_generator.scad` is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International, see <https://github.com/torwanbukaj/ikea-brio-others-compatible-train-tracks-generator>. `train_tracks_generator.scad` is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International and forked from <https://github.com/torwanbukaj/ikea-brio-others-compatible-train-tracks-generator>.
Binary file not shown.
-61
View File
@@ -1,61 +0,0 @@
/* https://github.com/torwanbukaj/ikea-brio-others-compatible-train-tracks-generator */
include <train_tracks_generator.scad>
// track_tester();
// A2 Mini Straight
*track(length = 54, end1 = "plug", end2 = "nest", cutout = false);
// B2 Mini Straight
*track(length = 54, end1 = "plug", end2 = "plug", cutout = false);
// C2 Mini Straight
*track(length = 54, end1 = "nest", end2 = "nest", cutout = false);
// A3 Middle Straight
*track(length = 72, end1 = "plug", end2 = "nest", cutout = false);
// A1 Short Straight
*track(length = 108, end1 = "plug", end2 = "nest", cutout = false);
// A Medium Straight
*track(length = 144, end1 = "plug", end2 = "nest", cutout = false);
// D Long Straight
*track(length = 216, end1 = "plug", end2 = "nest", cutout = false);
// E Large Curve
*track_arc(angle = 45, radius = 182, end1 = "nest", end2 = "plug", cutout = false, both_sides = true);
// E1 Short Curve
*track_arc(angle = 45, radius = 90, end1 = "nest", end2 = "plug", cutout = false, both_sides = true);
// H Cross
*intersection(angle = 90, lengthA = 108, lengthB = 108, end1A = "nest", end2A = "plug", end1B = "nest", end2B = "plug", both_sides = true);
// H2 Criss Cross
*intersection(angle = 45, lengthA = 144, lengthB = 144, end1A = "nest", end2A = "plug", end1B = "nest", end2B = "plug", both_sides = false);
// L Curved Switch
*switch(angleR = 0, radiusR = 0, endR = "none", angleL = 45, radiusL = 182, endL = "plug", lengthS = 144, endS = "plug", endCommon = "nest", both_sides = true);
// M Curved Switch
*switch(angleR = 0, radiusR = 0, endR = "none", angleL = 45, radiusL = 182, endL = "nest", lengthS = 144, endS = "nest", endCommon = "plug", both_sides = true);
// I Double Curved Switch
*switch(angleR = 45, radiusR = 182, endR = "plug", angleL = 45, radiusL = 182, endL = "plug", lengthS = 144, endS = "plug", endCommon = "nest", both_sides = false);
// J Double Curved Switch
*switch(angleR = 45, radiusR = 182, endR = "nest", angleL = 45, radiusL = 182, endL = "nest", lengthS = 144, endS = "nest", endCommon = "plug", both_sides = false);
// O Short Curved Switch
*switch(angleR = 45, radiusR = 90, endR = "plug", angleL = 45, radiusL = 90, endL = "plug", lengthS = 0, endS = "none", endCommon = "nest", both_sides = false);
// P Short Curved Switch
*switch(angleR = 45, radiusR = 90, endR = "nest", angleL = 45, radiusL = 90, endL = "nest", lengthS = 0, endS = "none", endCommon = "plug", both_sides = false);
// O1 Short Curved Switch
*switch(angleR = 0, radiusR = 0, endR = "none", angleL = 45, radiusL = 90, endL = "plug", lengthS = 108, endS = "plug", endCommon = "nest", both_sides = true);
// P1 Short Curved Switch
*switch(angleR = 0, radiusR = 0, endR = "none", angleL = 45, radiusL = 90, endL = "nest", lengthS = 108, endS = "nest", endCommon = "plug", both_sides = true);
+104 -7
View File
@@ -62,16 +62,16 @@ ikea_track_nest_neck_length = 11; // 11
ikea_track_nest_txt = "I"; ikea_track_nest_txt = "I";
// Track Plug Brio (do not change) // Track Plug Brio (do not change)
brio_track_plug_radius = 6.25; // 6.25 brio_track_plug_radius = 6; // 6.25
brio_track_plug_radius_ext = 6.5; // 6.5 for a dog-bone with springy plug brio_track_plug_radius_ext = 6.25; // 6.5 for a dog-bone with springy plug
brio_track_plug_neck_width = 6.1; // 6.1 brio_track_plug_neck_width = 6; // 6.1
brio_track_plug_neck_length = 12; // 12 brio_track_plug_neck_length = 18-brio_track_plug_radius; // 12
brio_track_plug_txt = "B"; brio_track_plug_txt = "B";
// Track Nest Brio (do not change) // Track Nest Brio (do not change)
brio_track_nest_radius = 6.4; // 6.4 brio_track_nest_radius = 6.5; // 6.4
brio_track_nest_neck_width = 6.3; // 6.3 brio_track_nest_neck_width = 7.3; // 6.3
brio_track_nest_neck_length = 12; // 12 brio_track_nest_neck_length = 18-brio_track_nest_radius; // 12
brio_track_nest_txt = "B"; brio_track_nest_txt = "B";
// Bridge components (do not change) // Bridge components (do not change)
@@ -1517,3 +1517,100 @@ module tracks_adapter(length = 30, nest = "B", plug = "I") {
} }
} }
} }
// ### BRIO TRAIN TRACKS AS MODULES
// A2 Mini Straight
module straight_mini_a2() { // make me
track(length = 54, end1 = "plug", end2 = "nest", cutout = false);
}
// B2 Mini Straight
module straight_mini_b2() { // make me
track(length = 54, end1 = "plug", end2 = "plug", cutout = false);
}
// C2 Mini Straight
module straight_mini_c2() { // make me
track(length = 54, end1 = "nest", end2 = "nest", cutout = false);
}
// A3 Middle Straight
module straight_middle_a3() { // make me
track(length = 72, end1 = "plug", end2 = "nest", cutout = false);
}
// A1 Short Straight
module straight_short_a1() { // make me
track(length = 108, end1 = "plug", end2 = "nest", cutout = false);
}
// A Medium Straight
module straight_medium_a() { // make me
track(length = 144, end1 = "plug", end2 = "nest", cutout = false);
}
// D Long Straight
module straight_long_d() { // make me
track(length = 216, end1 = "plug", end2 = "nest", cutout = false);
}
// E Large Curve
module curve_large_e() { // make me
track_arc(angle = 45, radius = 182, end1 = "nest", end2 = "plug", cutout = false, both_sides = true);
}
// E1 Short Curve
module curve_short_e1() { // make me
track_arc(angle = 45, radius = 90, end1 = "nest", end2 = "plug", cutout = false, both_sides = true);
}
// H Cross
module cross_h() { // make me
intersection(angle = 90, lengthA = 108, lengthB = 108, end1A = "nest", end2A = "plug", end1B = "nest", end2B = "plug", both_sides = true);
}
// H2 Criss Cross
module criss_cross_h2() { // make me
intersection(angle = 45, lengthA = 144, lengthB = 144, end1A = "nest", end2A = "plug", end1B = "nest", end2B = "plug", both_sides = false);
}
// L Curved Switch
module switch_curved_l() { // make me
switch(angleR = 0, radiusR = 0, endR = "none", angleL = 45, radiusL = 182, endL = "plug", lengthS = 144, endS = "plug", endCommon = "nest", both_sides = true);
}
// M Curved Switch
module switch_curved_m() { // make me
switch(angleR = 0, radiusR = 0, endR = "none", angleL = 45, radiusL = 182, endL = "nest", lengthS = 144, endS = "nest", endCommon = "plug", both_sides = true);
}
// I Double Curved Switch
module switch_double_curved_i() { // make me
switch(angleR = 45, radiusR = 182, endR = "plug", angleL = 45, radiusL = 182, endL = "plug", lengthS = 144, endS = "plug", endCommon = "nest", both_sides = false);
}
// J Double Curved Switch
module switch_double_curved_j() { // make me
switch(angleR = 45, radiusR = 182, endR = "nest", angleL = 45, radiusL = 182, endL = "nest", lengthS = 144, endS = "nest", endCommon = "plug", both_sides = false);
}
// O Short Curved Switch
module switch_short_curved_o() { // make me
switch(angleR = 45, radiusR = 90, endR = "plug", angleL = 45, radiusL = 90, endL = "plug", lengthS = 0, endS = "none", endCommon = "nest", both_sides = false);
}
// P Short Curved Switch
module switch_short_curved_p() { // make me
switch(angleR = 45, radiusR = 90, endR = "nest", angleL = 45, radiusL = 90, endL = "nest", lengthS = 0, endS = "none", endCommon = "plug", both_sides = false);
}
// O1 Short Curved Switch
module switch_short_curved_o1() { // make me
switch(angleR = 0, radiusR = 0, endR = "none", angleL = 45, radiusL = 90, endL = "plug", lengthS = 108, endS = "plug", endCommon = "nest", both_sides = true);
}
// P1 Short Curved Switch
module switch_short_curved_p1() { // make me
switch(angleR = 0, radiusR = 0, endR = "none", angleL = 45, radiusL = 90, endL = "nest", lengthS = 108, endS = "nest", endCommon = "plug", both_sides = true);
}