#! /bin/sh
set -e
builddefs=params.json
run () {
echo "=== $*"
"$@"
}
render () {
basename=$1; shift
run openscad -o $basename "$@" temp-tower.scad 2>&1 | tee $basename.log
mkdir -p Metadata
custom=Metadata/Prusa_Slicer_custom_gcode_per_print_z.xml
(
echo ''
echo ''
sed -n 's/ECHO: "CUSTOM##\(.*\)"/\1/p' $basename.log
echo ''
echo ''
) > $custom
run zip $basename $custom
rm $custom $basename.log
rmdir Metadata
}
paramsets () {
cat $builddefs | jq -r '.parameterSets | keys[] | select(length > 0)'
}
case "$1" in
-h|-help|--help)
cat <