From 4feec7501e5b249a4b9a1a831c2eb9170d2c5a35 Mon Sep 17 00:00:00 2001 From: mmcwilliams Date: Tue, 28 May 2024 21:13:13 -0400 Subject: [PATCH] Add script for rendering all STLs --- scripts/scad.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 scripts/scad.sh diff --git a/scripts/scad.sh b/scripts/scad.sh new file mode 100644 index 0000000..70513c4 --- /dev/null +++ b/scripts/scad.sh @@ -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 \ No newline at end of file