-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathdxf-roundtrip.sh
More file actions
executable file
·66 lines (63 loc) · 1.82 KB
/
Copy pathdxf-roundtrip.sh
File metadata and controls
executable file
·66 lines (63 loc) · 1.82 KB
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
57
58
59
60
61
62
63
64
65
66
#!/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) ODAFileConverter=/Applications/ODAFileConverter.app/Contents/MacOS/ODAFileConverter ;;
Linux) ODAFileConverter=/usr/bin/ODAFileConverter ;;
Windows) ODAFileConverter=ODAFileConverter ;;
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 ;;
r11) r=12 ;;
r1[0234]) r=${r:1} ;;
*) case $f in
*_20*)
r=${f:(-4)}
f=$(basename "$f" "_$r")
;;
*_r9)
r=9
f=$(basename "$f" "_r$r")
;;
*_r11)
r=12
;;
*_r1[0234])
r=${f:(-2)}
f=$(basename "$f" "_r$r")
;;
*)
echo "wrong version $r"
exit
;;
esac ;;
esac
case $r in
9|10|11|12|13|14|2000|2004|2007|2010|2013|2018) ;;
*) make -s -C examples odaversion
r="$(examples/odaversion "$full")"
;;
esac
echo programs/dwg2dxf -y -v4 -o "${f}_${r}.dxf" "$full"
programs/dwg2dxf -y -v4 -o "${f}_${r}.dxf" "$full" 2>"${f}_${r}.log" ||
grep Error "${f}_${r}.log"
mv "${f}_${r}.dxf" test/
echo ODAFileConverter "test" . "ACAD$r" DWG 0 1 "${f}_${r}.dxf"
$ODAFileConverter "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