forked from LibreDWG/libredwg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdxf.in
78 lines (76 loc) · 2.31 KB
/
dxf.in
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
67
68
69
70
71
72
73
74
75
76
77
78
#!/bin/sh
# create -v3 logs and dxf's with dwg2dxf/dxfwrite
srcdir="@srcdir@"
top_builddir="@top_builddir@"
CFLAGS="@CFLAGS@"
timeout="@TIMEOUT_30@"
case "$CFLAGS" in
*-DDEBUG_CLASSES*) timeout= ;;
*) ;;
esac
make -s -C src
make -s -C programs dwg2dxf dxfwrite
@DSYMUTIL@ programs/dwg2dxf programs/dxfwrite
v=-v3
# dummy to please shellcheck
test -z "$v" && echo $top_builddir
args=-y
out=
for d in "$@"; do
case $d in
-v*) v="$d" ;;
--as=*) args="$args $d" ;;
-m) args="$args $d" ;;
-b) args="$args $d" ;;
-Ijson) ext=json ;;
-Idxf) ext=dxf ;;
-y) ;;
*)
if [ ! -f "$d" ]; then
if [ -f "$srcdir/test/test-data/$d" ]
then
d="$srcdir/test/test-data/$d";
elif [ -f "$srcdir/test/test-data/$d.dwg" ]
then
d="$srcdir/test/test-data/$d.dwg"
ext=dwg
elif [ -f "$srcdir/test/test-data/$d.json" ]
then
d="$srcdir/test/test-data/$d.json"
ext=json
elif [ -f "$srcdir/test/test-data/$d.dxf" ]
then
d="$srcdir/test/test-data/$d.dxf"
ext=dxf
fi
fi
xd=$(dirname "$d")
dir=_$(basename "$xd")
if [ "$dir" = "_test-data" ]; then dir=""; fi
if [ "$dir" = "_td" ]; then dir=""; fi
if [ "$dir" = "_." ]; then dir=""; fi
case $(basename "$d") in
*.dwg) ext=dwg ;;
*.DWG) ext=dwg ;;
*.dxf) ext=dxf ;;
*.DXF) ext=dxf ;;
*.json) ext=json ;;
*.JSON) ext=json ;;
*) echo "Illegal extension for $d"; exit ;;
esac
b=$(basename "$d" .$ext)
log="$b$dir.log"
out="$b$dir.dxf"
if [ x$ext = xdwg ]; then
echo "$timeout @LTEXEC@ programs/dwg2dxf $args $v -o $out $d 2>$log"
# shellcheck disable=SC2086
$timeout @LTEXEC@ programs/dwg2dxf $args "$v" -o "$out" "$d" 2>"$log"
else
echo "$timeout @LTEXEC@ programs/dxfwrite $args $v -o $out $d 2>$log"
# shellcheck disable=SC2086
$timeout @LTEXEC@ programs/dxfwrite $args "$v" -o "$out" "$d" 2>"$log"
fi
tail -n2 "$log"
;;
esac
done