2020-05-28 16:16:45 +00:00
|
|
|
#!/bin/bash
|
|
|
|
V="v3"
|
|
|
|
|
|
|
|
echo "Rendering GNAL ${V}"
|
|
|
|
|
|
|
|
VERSION=`bash ./scripts/version.sh`
|
|
|
|
CPU=`bash ./scripts/cpu.sh`
|
|
|
|
DIST=./stl
|
|
|
|
IMG=./img
|
|
|
|
|
|
|
|
NOTES=./notes/${V}.csv
|
2020-08-19 12:41:26 +00:00
|
|
|
#"quarter_a" "quarter_b" "quarter_c" "quarter_d"
|
|
|
|
#quarter pieces not rendering properly
|
|
|
|
FILES=( "spindle_bottom" "spindle_top" "spacer" "top" "spiral" "insert_s8" "insert_16" "spacer_16" )
|
2020-05-28 16:16:45 +00:00
|
|
|
SIZES=( "50ft" "100ft" )
|
|
|
|
|
|
|
|
mkdir -p $DIST
|
|
|
|
|
|
|
|
echo "version,cpu,file,file_hash,file_size,source_hash,source_size,facets,volume,render_time" > $NOTES
|
|
|
|
|
|
|
|
for SIZE in "${SIZES[@]}"
|
|
|
|
do
|
|
|
|
:
|
|
|
|
mkdir -p "${DIST}/${SIZE}_${V}"
|
|
|
|
scad="${SIZE}_${V}/gnal_${SIZE}.scad"
|
|
|
|
srchash=`sha256sum "${scad}" | awk '{ print $1 }'`
|
|
|
|
srcsize=`wc -c < "${scad}"`
|
|
|
|
srcsize=`echo $srcsize | xargs`
|
|
|
|
|
|
|
|
for FILE in "${FILES[@]}"
|
|
|
|
do
|
|
|
|
:
|
|
|
|
stl="${DIST}/${SIZE}_${V}/gnal_${SIZE}_${FILE}.stl"
|
|
|
|
png="${IMG}/gnal_${SIZE}_${V}_${FILE}.png"
|
|
|
|
echo "${scad} - ${FILE}"
|
|
|
|
start=`date +%s`
|
2020-05-29 14:27:12 +00:00
|
|
|
if [[ "${SIZE}" == "100ft" ]]; then
|
2020-05-29 14:24:41 +00:00
|
|
|
openscad -o "$stl" -D "PART=\"${FILE}\"" -D "FN=800" "${scad}"
|
|
|
|
else
|
|
|
|
openscad -o "$stl" -D "PART=\"${FILE}\"" -D "FN=600" "${scad}"
|
|
|
|
fi
|
|
|
|
|
2020-05-28 16:16:45 +00:00
|
|
|
end=`date +%s`
|
|
|
|
runtime=$((end-start))
|
2020-08-19 12:41:26 +00:00
|
|
|
|
2020-05-28 16:16:45 +00:00
|
|
|
fileSize=`wc -c < "$stl"`
|
|
|
|
fileSize=`echo $fileSize | xargs`
|
2020-08-19 12:41:26 +00:00
|
|
|
|
2020-06-04 13:46:13 +00:00
|
|
|
if ! [ -x "$(command -v admesh)" ]; then
|
|
|
|
facets="N/A"
|
|
|
|
volume="N/A"
|
|
|
|
else
|
2020-08-19 05:14:04 +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`
|
2020-08-19 12:41:26 +00:00
|
|
|
fileSize="${newSize}"
|
2020-08-19 05:14:04 +00:00
|
|
|
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-31 01:53:57 +00:00
|
|
|
|
2020-08-19 12:41:26 +00:00
|
|
|
hash=`sha256sum "$stl" | awk '{ print $1 }'`
|
|
|
|
|
2020-05-28 16:16:45 +00:00
|
|
|
line="${VERSION},${CPU},$stl,$hash,$fileSize,$srchash,$srcsize,$facets,$volume,$runtime"
|
|
|
|
echo "$line" >> $NOTES
|
|
|
|
echo "$line"
|
|
|
|
|
|
|
|
echo "Rendering image of ${stl}..."
|
|
|
|
|
2020-05-31 01:53:57 +00:00
|
|
|
if [[ "${FILE}" == "spiral" ]]; then
|
|
|
|
tmp=`mktemp`
|
|
|
|
fullPath=`realpath "${stl}"`
|
|
|
|
data="import(\"${fullPath}\");"
|
|
|
|
echo data > "${tmp}.scad"
|
|
|
|
openscad -o "$png" --imgsize=1920,1080 --colorscheme=DeepOcean "${tmp}.scad"
|
|
|
|
else
|
|
|
|
openscad -o "$png" --imgsize=1920,1080 --colorscheme=DeepOcean -D "PART=\"${FILE}\"" "${scad}"
|
|
|
|
fi
|
2020-05-29 16:07:42 +00:00
|
|
|
|
2020-05-28 16:16:45 +00:00
|
|
|
done
|
|
|
|
done
|