2020-05-22 03:43:59 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2020-05-23 19:15:03 +00:00
|
|
|
echo "Rendering GNAL v1"
|
2020-05-22 03:43:59 +00:00
|
|
|
|
2020-05-22 18:54:38 +00:00
|
|
|
VERSION=`bash ./scripts/version.sh`
|
2020-05-22 16:51:27 +00:00
|
|
|
CPU=`bash ./scripts/cpu.sh`
|
2020-05-27 19:09:11 +00:00
|
|
|
DIST=./stl/
|
2020-05-22 03:43:59 +00:00
|
|
|
NOTES=./notes/v1.csv
|
|
|
|
FILES=( "spacer" "top" "spiral_top" "spiral_bottom" )
|
2020-05-22 15:58:23 +00:00
|
|
|
SIZES=( "50ft" "100ft" )
|
2020-05-22 03:43:59 +00:00
|
|
|
|
|
|
|
mkdir -p $DIST
|
|
|
|
|
2020-05-22 23:09:02 +00:00
|
|
|
echo "version,cpu,file,file_hash,file_size,source_hash,source_size,facets,volume,render_time" > $NOTES
|
2020-05-22 03:43:59 +00:00
|
|
|
|
|
|
|
for SIZE in "${SIZES[@]}"
|
|
|
|
do
|
|
|
|
:
|
2020-05-22 15:09:15 +00:00
|
|
|
mkdir -p "${DIST}/${SIZE}_v1"
|
2020-05-22 03:43:59 +00:00
|
|
|
srchash=`sha256sum "${SIZE}_v1/gnal_${SIZE}.scad" | awk '{ print $1 }'`
|
|
|
|
srcsize=`wc -c < "${SIZE}_v1/gnal_${SIZE}.scad"`
|
|
|
|
srcsize=`echo $srcsize | xargs`
|
|
|
|
|
|
|
|
for FILE in "${FILES[@]}"
|
|
|
|
do
|
|
|
|
:
|
2020-05-23 18:26:18 +00:00
|
|
|
stl="${DIST}/${SIZE}_v1/gnal_${SIZE}_${FILE}.stl"
|
|
|
|
scad="${SIZE}_v1/${FILE}.scad"
|
|
|
|
echo "$scad"
|
2020-05-22 03:43:59 +00:00
|
|
|
start=`date +%s`
|
2020-05-23 18:26:18 +00:00
|
|
|
openscad -o "$stl" "$scad"
|
2020-05-22 03:43:59 +00:00
|
|
|
end=`date +%s`
|
|
|
|
runtime=$((end-start))
|
2020-05-23 18:26:18 +00:00
|
|
|
hash=`sha256sum "$stl" | awk '{ print $1 }'`
|
|
|
|
fileSize=`wc -c < "$stl"`
|
2020-05-22 03:43:59 +00:00
|
|
|
fileSize=`echo $fileSize | xargs`
|
2020-06-04 13:46:13 +00:00
|
|
|
if ! [ -x "$(command -v admesh)" ]; then
|
|
|
|
facets="N/A"
|
|
|
|
volume="N/A"
|
|
|
|
else
|
2020-08-19 14:27:50 +00:00
|
|
|
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
|
2020-06-04 13:46:13 +00:00
|
|
|
ao=`admesh -c "$stl"`
|
|
|
|
facets=`echo "$ao" | grep "Number of facets" | awk '{print $5}'`
|
|
|
|
volume=`echo "$ao" | grep "Number of parts" | awk '{print $8}'`
|
|
|
|
fi
|
2020-05-22 23:09:02 +00:00
|
|
|
line="${VERSION},${CPU},gnal_${SIZE}_${FILE}.stl,$hash,$fileSize,$srchash,$srcsize,$facets,$volume,$runtime"
|
2020-05-22 16:51:27 +00:00
|
|
|
echo "$line" >> $NOTES
|
|
|
|
echo "$line"
|
2020-05-22 03:43:59 +00:00
|
|
|
done
|
|
|
|
done
|