Tip: For editing the code, it is best to use Notepad++. It instantly processes heavy G-code files and performs bulk search-and-replace via
Ctrl + Hwithout any glitches.
Copy and paste this at the very beginning of the file, making sure to delete the original default M03/M04 command generated by FlatCAM (if it was present).
G-Code
G21 ; Set units to millimeters (mm)
G90 ; Absolute positioning
G94 ; Feedrate per minute mode
S800 ; Laser power (adjust based on your tests)
F800 ; Engraving speed (adjust based on your tests)
| Find what | Replace with / Action | Description |
|---|---|---|
G01 Z-2.4000 |
M03 |
Turn Laser ON instead of plunging the mill |
G00 Z2.4000 |
M05 |
Turn Laser OFF instead of retracting the mill |
G01 F60.00 |
Delete (leave the field empty) | Plunge feedrate is no longer needed |
G01 F120.00 |
Delete (leave the field empty) | Milling feedrate is no longer needed |
Before saving, make sure to press Ctrl + F in Notepad++ and audit the file using these three letters:
-
🔍 Search for
Z$\rightarrow$ 0 matches.-
Why: The Z-axis is dead to the laser. If a stray
Z...coordinate sneaks in, the machine will spin an empty motor, creating unwanted delays and leaving burn marks on the board.
-
Why: The Z-axis is dead to the laser. If a stray
-
🔍 Search for
F$\rightarrow$ Exactly 1 match (only in the header:F800).-
Why: If an
Fpops up mid-program, the laser will drop its speed down to a crawl (e.g., the oldF60plunge rate from the mill) and instantly burn through the copper/textolite.
-
Why: If an
-
🔍 Search for
S$\rightarrow$ Exactly 1 match (only in the header:S800).-
Why: Extra
Scommands in the program body will cause the laser to spontaneously change its power output right along the tracks.
-
Why: Extra
Make sure that at the very end of the program (right after the final M05), the machine goes home. This allows you to immediately load the next file (e.g., drilling) and stay perfectly aligned with the workpiece origin, avoiding any axis displacement.
G-Code
M05 ; Turn off the laser
G00 X0.0000 Y0.0000 ; Return strictly to the XY zero origin of your workpiece
M30 ; End of program, rewind cycle, and clear controller buffer
The Golden Rule: Inside the main body of the file (between the header and the footer), the code must be absolutely "clean"—containing only
XandYcoordinates, andM03/M05commands. Everything else goes to the bin.
