GNAL/scripts/binary_convert.sh

36 lines
786 B
Bash

#!/bin/bash
# "v1" not working as expected
VERSIONS=( "v2" "v3" )
SIZES=( "50ft" "100ft" )
for VERSION in "${VERSIONS[@]}"
do
:
for SIZE in "${SIZES[@]}"
do
:
echo "./stl/${SIZE}_${VERSION}"
FILES=./stl/${SIZE}_${VERSION}/*.stl
for stl in $FILES
do
fileSize=`bash ./scripts/size.sh "$stl"`
fileSize=`echo $newSize | xargs`
firstline=`head -n 1 "$stl"`
if [[ $firstline == solid* ]]; then
echo "Converting $stl to binary..."
#convert from ascii to binary
admesh -c -b "$stl" "$stl"
newSize=`bash ./scripts/size.sh "$stl"`
newSize=`echo $newSize | xargs`
percent=`echo "scale=1;($newSize/$fileSize)*100" | bc`
#fileSize="${newSize}"
echo "Binary conversion created STL file ${percent}% of original"
fi
done
done
done