-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexport.sh
More file actions
executable file
·64 lines (54 loc) · 1.82 KB
/
export.sh
File metadata and controls
executable file
·64 lines (54 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/bash
# SpeedsterAI — STL Export Pipeline
# Exports print-ready front and back half STLs from speedster-ai.scad
#
# Usage: ./export.sh [output_dir]
# output_dir defaults to ./models/
#
# Output files:
# speedster-ai-front.stl — Front half (print baffle-face down, already oriented)
# speedster-ai-back.stl — Back half (print flat back-face down, rotated 180°)
#
# Requires OpenSCAD installed at the standard macOS location.
# Full renders take ~2-3 minutes per half.
set -e
SCAD="speedster-ai.scad"
OUTDIR="${1:-models}"
# Auto-detect OpenSCAD
if [ -z "$OPENSCAD" ]; then
if command -v openscad &>/dev/null; then
OPENSCAD="openscad"
elif [ -x "/Applications/OpenSCAD.app/Contents/MacOS/OpenSCAD" ]; then
OPENSCAD="/Applications/OpenSCAD.app/Contents/MacOS/OpenSCAD"
else
echo "Error: OpenSCAD not found. Install it or set OPENSCAD env var." >&2
exit 1
fi
fi
if [ ! -f "$SCAD" ]; then
echo "Error: $SCAD not found. Run from project root." >&2
exit 1
fi
mkdir -p "$OUTDIR"
TMPDIR=$(mktemp -d)
trap "rm -rf $TMPDIR" EXIT
SCAD_ABS="$(cd "$(dirname "$SCAD")" && pwd)/$(basename "$SCAD")"
echo "Exporting STLs to $OUTDIR/..."
echo ""
# Export front half
echo "Exporting front half..."
cat > "$TMPDIR/front.scad" << EOF
include <$SCAD_ABS>
front_half();
EOF
$OPENSCAD "$TMPDIR/front.scad" -D 'render_mode=99' -o "$OUTDIR/speedster-ai-front.stl" 2>&1 | grep -E 'Status|Genus|Vertices|Facets|Error'
# Export back half (rotated so flat back face is on build plate)
echo "Exporting back half..."
cat > "$TMPDIR/back.scad" << EOF
include <$SCAD_ABS>
rotate([180,0,0]) back_half();
EOF
$OPENSCAD "$TMPDIR/back.scad" -D 'render_mode=99' -o "$OUTDIR/speedster-ai-back.stl" 2>&1 | grep -E 'Status|Genus|Vertices|Facets|Error'
echo ""
echo "Done. STLs saved to $OUTDIR/"
ls -lh "$OUTDIR"/*.stl