Hi,

I have just finished building a home-brew XY-plotter using an Arduino UNO with a Protoneer CNC shield. It is mechanically OK.

I created a drawing with LibreCAD and used dxf2gcode to convert to g-code.
UniversalGcodeSender is used to send codes to the Arduino
The original file had tool and Z commands which I removed. It would help if I could produce a file for plotting rather than CNC.

I'm getting unexpected results from the g-code below.

The first is initial pen movement. As I do not have homing enabled I would expect the current pen position to be the origin. Not so. It's like an initial 'G0 X90 Y20' is sent first, but the pen moves directly to where the first line is to be drawn rather than going there first. At the end, the pen stops at the right spot relative to the shapes.

The other problem is that the pen does not lift between shapes. It is lowered at the beginning with M8 and only lifted at the end at M2. I'm using Coolant for pen control. The Console messages indicate that the 3 lines with M9 are skipped.

Why is M9 skipped? It works when entered manually.



Code:
(Generated with: DXF2GCODE, Version: Py2.7.12 PyQt4.11.4, Date: $Date$)
(Created from file: /home/cave/LibreCAD/PlotZero.dxf)
(Time: Sat Sep 23 19:34:56 2017)

G21 (millimeters)  G90 (Absolute)

(*** LAYER: 0 ***)

(* SHAPE Nr: 2 *)
G0 X  60.500 Y   8.500
M8
F600
G1 X  60.500 Y  39.500
G1 X  90.500 Y  39.500
G1 X  90.500 Y   8.500
G1 X  60.500 Y   8.500
M9

(* SHAPE Nr: 1 *)
G0 X  22.139 Y  21.639
M8
F600
G2 X  36.361 Y  35.861 I   7.111 J   7.111
G2 X  22.139 Y  21.639 I  -7.111 J  -7.111
M9

(* SHAPE Nr: 0 *)
G0 X  16.463 Y  14.463
M8
F600
G2 X  43.537 Y  41.537 I  13.537 J  13.537
G2 X  16.463 Y  14.463 I -13.537 J -13.537
M9

G0 X   0.000 Y   0.000
M2 (Program end)
Code:
Grbl 1.1f ['$' for help]
>>> $$
>>> $G
$0 = 10    (Step pulse time, microseconds)
$1 = 25    (Step idle delay, milliseconds)
$2 = 0    (Step pulse invert, mask)
$3 = 0    (Step direction invert, mask)
$4 = 0    (Invert step enable pin, boolean)
$5 = 0    (Invert limit pins, boolean)
$6 = 0    (Invert probe pin, boolean)
$10 = 1    (Status report options, mask)
$11 = 0.010    (Junction deviation, millimeters)
$12 = 0.002    (Arc tolerance, millimeters)
$13 = 0    (Report in inches, boolean)
$20 = 0    (Soft limits enable, boolean)
$21 = 0    (Hard limits enable, boolean)
$22 = 0    (Homing cycle enable, boolean)
$23 = 0    (Homing direction invert, mask)
$24 = 25.000    (Homing locate feed rate, mm/min)
$25 = 500.000    (Homing search seek rate, mm/min)
$26 = 250    (Homing switch debounce delay, milliseconds)
$27 = 3.000    (Homing switch pull-off distance, millimeters)
$30 = 1000    (Maximum spindle speed, RPM)
$31 = 0    (Minimum spindle speed, RPM)
$32 = 0    (Laser-mode enable, boolean)
$100 = 80.000    (X-axis travel resolution, step/mm)
$101 = 80.000    (Y-axis travel resolution, step/mm)
$102 = 40.000    (Z-axis travel resolution, step/mm)
$110 = 500.000    (X-axis maximum rate, mm/min)
$111 = 500.000    (Y-axis maximum rate, mm/min)
$112 = 500.000    (Z-axis maximum rate, mm/min)
$120 = 10.000    (X-axis acceleration, mm/sec^2)
$121 = 10.000    (Y-axis acceleration, mm/sec^2)
$122 = 10.000    (Z-axis acceleration, mm/sec^2)
$130 = 350.000    (X-axis maximum travel, millimeters)
$131 = 350.000    (Y-axis maximum travel, millimeters)
$132 = 50.000    (Z-axis maximum travel, millimeters)
ok
[GC:G0 G54 G17 G21 G90 G94 M5 M9 T0 F0 S0]