-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrender.sh
More file actions
executable file
·34 lines (31 loc) · 982 Bytes
/
render.sh
File metadata and controls
executable file
·34 lines (31 loc) · 982 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
for out in ./output/*.stl; do
rm $out >> /dev/null 2>&1
done
rm ./logs/log.log >> /dev/null 2>&1
compile() {
START=$(date +%s)
export filename=`echo $1 | cut -c 9- | cut -d'.' -f1`
result=0
if [ -z ${2+x} ]; then
result="$(openscad --hardwarnings -o ./output/$filename.stl $1 2>&1)"
else
result="$(openscad --hardwarnings --backend=$2 -o ./output/$filename.stl $1 2>&1)"
fi
if [[ $result != *"ERROR:"* && $result != *"WARNING"* ]]; then
END=$(date +%s)
DIFF=$(( $END - $START ))
if (( DIFF>59 )); then
printf "[\e[32mRendered\e[0m] $filename.stl in %02d:%02d:%02d\n" \
"$((DIFF/3600))" "$((DIFF%3600/60))" "$((DIFF%60))"
else
echo -e "[\e[32mRendered\e[0m] $filename.stl in $DIFF seconds"
fi
else
echo -e "[\e[31mFailed\e[0m] $filename.scad"
echo $result
fi
}
for file in ./parts/*.scad; do
compile $file $1 &
done
wait