Add a script that generates a pov model from an stl but gives it the proper name (of the file). Using this to build renders of the models for launch (tomorrow?)

This commit is contained in:
mmcwilliams 2020-08-20 08:35:12 -04:00
parent 563b24d90e
commit 03059f7c5c
1 changed files with 26 additions and 0 deletions

26
scripts/stl2pov.sh Normal file
View File

@ -0,0 +1,26 @@
#!/bin/bash
INPUT="$1"
OUTPUT="$2"
if [ "$INPUT" = "" ]; then
exit 1
fi
if [ "$OUTPUT" = "" ]; then
exit 1
fi
FILE_NAME=`basename "${INPUT}" .stl`
TMP_FILE=`mktemp`
stl2pov "${INPUT}" > "${TMP_FILE}"
DECLARE_LINE=`cat "${TMP_FILE}" | grep "^#declare "`
MODEL_NAME=`echo "${DECLARE_LINE}" | awk '{print $2}'`
NEW_LINE=`echo $DECLARE_LINE | sed "s/${MODEL_NAME}/${FILE_NAME}/g"`
cat "${TMP_FILE}" | sed "s/$DECLARE_LINE/$NEW_LINE/" > "${OUTPUT}"
rm "${TMP_FILE}"
echo "${FILE_NAME}"