Add binary conversion step to v1 and v2 scripts. TODO: Add a script that will loop through existing files and convert them to binary for big $$$ (diskspace) savings.

This commit is contained in:
mmcwilliams 2020-08-19 10:27:50 -04:00
parent d2e15e4c83
commit 9e0e84bdcd
2 changed files with 20 additions and 0 deletions

View File

@ -38,6 +38,16 @@ do
facets="N/A"
volume="N/A"
else
firstline=`head -n 1 "$stl"`
if [[ $firstline == solid* ]]; then
#convert from ascii to binary
admesh -c -b "$stl" "$stl"
newSize=`wc -c < "$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
ao=`admesh -c "$stl"`
facets=`echo "$ao" | grep "Number of facets" | awk '{print $5}'`
volume=`echo "$ao" | grep "Number of parts" | awk '{print $8}'`

View File

@ -42,6 +42,16 @@ do
facets="N/A"
volume="N/A"
else
firstline=`head -n 1 "$stl"`
if [[ $firstline == solid* ]]; then
#convert from ascii to binary
admesh -c -b "$stl" "$stl"
newSize=`wc -c < "$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
ao=`admesh -c "$stl"`
facets=`echo "$ao" | grep "Number of facets" | awk '{print $5}'`
volume=`echo "$ao" | grep "Number of parts" | awk '{print $8}'`