-
-
Notifications
You must be signed in to change notification settings - Fork 233
/
dxf-roundtrip.sh
executable file
·56 lines (53 loc) · 1.54 KB
/
dxf-roundtrip.sh
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/usr/bin/env bash
# test dwg2dxf via teigha roundtrips
# for f in test/test-data/20*/*.dwg; do ./dxf-roundtrip.sh $f; done
case $(uname) in
Darwin) TeighaFileConverter=/Applications/TeighaFileConverter.app/Contents/MacOS/TeighaFileConverter ;;
Linux) TeighaFileConverter=/usr/bin/TeighaFileConverter ;;
Windows) TeighaFileConverter=TeighaFileConverter ;;
esac
#full=test/test-data/2000/$f.dwg
full=$1
if [ ! -f $full ]; then
echo $full not found
exit
fi
f=$(basename $full .dwg)
r=$(basename $(dirname $full))
case $r in
20*) ;;
r9) r=9 ;;
r1[0234]) r=${r:1} ;;
*) case $f in
*_20*)
r=${f:(-4)}
f=$(basename $f _$r)
;;
*_r9)
r=9
f=$(basename $f _r$r)
;;
*_r1[0234])
r=${f:(-2)}
f=$(basename $f _r$r)
;;
*)
echo wrong version $r
exit
;;
esac ;;
esac
echo programs/dwg2dxf -v4 -o ${f}_${r}.dxf $full
programs/dwg2dxf -v4 -o ${f}_${r}.dxf $full 2>${f}_${r}.log ||
grep Error ${f}_${r}.log
mv ${f}_${r}.dxf test/
echo TeighaFileConverter "test" . ACAD$r DWG 0 1 ${f}_${r}.dxf
$TeighaFileConverter "test" "." ACAD$r DWG 0 1 ${f}_${r}.dxf
mv test/${f}_${r}.dxf ./
if [ -f ${f}_${r}.dwg ]; then
echo test ${f}_${r}.dwg created from ${f}_${r}.dxf
programs/dwgread -v4 ${f}_${r}.dwg 2>${f}_${r}_dxf.log ||
grep Error ${f}_${r}_dxf.log
else
cat ${f}_${r}.dwg.err
fi