I generated gcode using the mods G-code/mill 2D
and G-code/mill 3D STL
modules. I want to run the generated g-code on a large format CNC machine controlled by grbl.
I took a look at the start of the generated program and checked what the initial commands were doing. The mach3 gcode language reference and this fabacademy post were useful resources.
%
G17 # select the x, y circular motion field
G21 # select the metric (mm) coordinate system
G40 # cutter compensation off
G49 # cutter height compensation off
G54 # select work offset coordinate system
G80 # cancel any previously used canned cycles
G90 # absolute position mode
G94 # feed rate units per minute (sets units for F words)
T1M06 # T1 picks tool #1, M06 executes the tool change
F600.0000 # feedrate in mm per minute
S11000 # set the spindle RPM
G00Z2.0000 # fast move to Z-coordinate
M03 # start spindle clockwise
G04 P1 # hold still for a unit of time (unit of time is seconds in GRBL)
G00Z2.0000 # fast move to Z-coordinate
G00X0.0000Y0.0000Z2.0000 # fast move to starting point
G01Z-20.0360 F300.0000 # plunge to the cutting depth
F600.0000 # pick up the speed
G01X24.0000Y0.0000Z-20.0360 # start cutting
Challenges with the generated GCODE
Tool change
I’m running the GCODE on a GRBL controller which doesn’t understand the T1M06
tool change command. For now I just removed this line from the GCODE file manually
Wait for spindle to speed up
The g-code generated by the 3D module contains G04 P1000
. GRBL interprets the value after P
as seconds (as linuxcnc does) and would therefore wait for a long time. Other controllers interpret the value as bein milliseconds.
As a workaround I change this line manually to G04 P1