AuerNameTag/make.sh

38 lines
1008 B
Bash
Raw Normal View History

2024-03-31 22:20:04 +02:00
#!/bin/bash
openscad="$(which openscad)"
2024-04-16 00:21:15 +02:00
colorscad="${COLORSCAD:-$(which colorscad.sh)}"
use_colorscad=false
2024-04-16 00:24:14 +02:00
test -x "$colorscad" && use_colorscad=false
2024-03-31 22:20:04 +02:00
if [[ $? -gt 0 && "$(uname)" == "Darwin" ]]; then
openscad="/Applications/OpenSCAD.app/Contents/MacOS/OpenSCAD"
fi
test -x "$openscad" || {
echo "OpenSCAD not found in PATH not in /Applications/OpenSCAD.app/Contents/MacOS/OpenSCAD"
exit 1
}
OUTDIR="./out"
test -d "$OUTDIR" || mkdir -p "$OUTDIR"
if [[ $# == 0 ]]; then
echo "Usage: $0 <name> [more names...]"
exit 1
fi
while [[ $# -gt 0 ]]; do
name="$1"
shift
echo -n generating for "$name"
2024-04-16 00:21:15 +02:00
if [[ "$use_colorscad" == "true" ]]; then
"$colorscad" -i "AuerNameTag.scad" -o "$OUTDIR/${name}.3mf" -- -D "name=\"$name\"" -D "part=3" &>/dev/null &
fi
"$openscad" -o "$OUTDIR/${name}_text.stl" -D "name=\"$name\"" -D "part=2" "AuerNameTag.scad" &>/dev/null &
"$openscad" -o "$OUTDIR/${name}_base.stl" -D "name=\"$name\"" -D "part=1" "AuerNameTag.scad" &>/dev/null &
wait
2024-04-16 00:21:15 +02:00
echo " done"
2024-03-31 22:20:04 +02:00
done