aboutsummaryrefslogtreecommitdiffstats
path: root/checker/src/models/build.sh
blob: 7d41728d528b9bae13082f35be8d7fc84cd13131 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/sh

gen() {
	output=$(openscad --export-format $1 $2 -o $3 2>&1)
	if [ $? -ne 0 ]; then
		echo "OPENSCAD LOG:"
		echo "$output"
		exit 1
	fi
	size=$(($(cat $3 | wc -c)))
	printf "GEN %-20s: " "$3"
	if [ $size -ge 50000 ]; then
		echo "skipped (too large)"
		rm "$3"
	else
		echo "done"
	fi
}

for fname in $(ls *.scad); do
	gen binstl $fname ${fname%.scad}-bin.stl
	gen asciistl $fname ${fname%.scad}-ascii.stl
done