Add script for rendering all STLs

This commit is contained in:
Matt McWilliams 2024-05-28 21:13:13 -04:00
parent df74b30113
commit 4feec7501e
1 changed files with 21 additions and 0 deletions

21
scripts/scad.sh Normal file
View File

@ -0,0 +1,21 @@
SCRIPT_NAME="intval2"
SCAD="scad/${SCRIPT_NAME}.scad"
listParts () {
cat "${1}" | grep 'PART ==' | grep -v 'debug' | awk -F'"' '{print $2}'
}
renderPart () {
part="${1}"
stl="stl/${SCRIPT_NAME}_${part}.stl"
openscad --export-format asciistl -o "${stl}" "${SCAD}"
}
allParts () {
PARTS=($(listParts "${SCAD}"))
for part in "${PARTS[@]}"; do
renderPart "${part}"
done
}
allParts