File: test-dxf2gcode

package info (click to toggle)
dxf2gcode 20191025-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 5,020 kB
  • sloc: python: 10,333; xml: 44; sh: 25; makefile: 17
file content (38 lines) | stat: -rwxr-xr-x 1,221 bytes parent folder | download
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
#!/bin/sh
#
# Convert SVG to DXF, then tell dxf2gcode to generate gcode for it.

set -e

SVG=/usr/share/icons/hicolor/scalable/apps/dxf2gcode.svg

# Ensure X is unavailable, the alternative is to use xvfb-run, but can
# cause dxf2gcode to hang on a dialog.
DISPLAY=
export DISPLAY

# Convert random SVG to test.dxf file
echo info: Converting SVG to EPS using inkscape
if ! inkscape $SVG -o $AUTOPKGTEST_TMP/test.eps 2>&1 ; then
    echo error: inkscape failed to convert SVG to EPS
    exit 1
fi
echo info: Converting EPS to DXF using pstoedit
if ! pstoedit -f dxf_s $AUTOPKGTEST_TMP/test.eps $AUTOPKGTEST_TMP/test.dxf 2>&1 ; then
    echo error: pstoedit failed to convert EPS to DXF
    exit 1
fi

# Convert test.dxf to test.ngc
echo info: Converting DXF to G-code using dxf2gcode
if ! dxf2gcode -platform  offscreen -q -e $AUTOPKGTEST_TMP/test $AUTOPKGTEST_TMP/test.dxf 2>&1| tee $AUTOPKGTEST_TMP/dxf2gcode.log ; then
    echo error: dxf2gcode returned error code when converting DXF to G-code
fi

if grep 'Export to FILE was successful' $AUTOPKGTEST_TMP/dxf2gcode.log ; then
    echo success: DXF to G-code conversion succeeded.
    exit 0
else
    echo error: dxf2gcode failed to convert DXF to G-code
    exit 1
fi