COLORSCHEME="DeepOcean" set -x # Script to render stls # Ref: https://3dprinting.stackexchange.com/questions/6046/how-can-i-create-png-image-files-from-stl-files for stl_file in downloads/stls/*.stl; do echo Rendering $stl_file T=__tmp__ # get args from json (if there) RENDER_ARGS="$(jq -r "[.[] | select(.filename==\"$(basename $stl_file .stl)\")][0].\"render-args\" // empty" _data/prints.json)" echo "$RENDER_ARGS import(\"$stl_file\");" >$T cat $T # render thumb and image openscad -o "img/stls/$(basename $stl_file .stl).png" --imgsize=512,512 --colorscheme=$COLORSCHEME $T openscad -o "img/stls/$(basename $stl_file .stl)@thumbnail.png" --imgsize=128,128 --colorscheme=$COLORSCHEME $T rm $T done