Skip to content

universalgeek56/Mill-to-Laser-Hack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 

Repository files navigation

Converting G-Code from Mill to Laser (FlatCAM → GRBL/Laser)

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 + H without any glitches.

1. Header

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)

2. Find and Replace in Notepad++ (Ctrl + H)

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

3. Final Express Audit (Ctrl + F)

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.
  • 🔍 Search for F $\rightarrow$ Exactly 1 match (only in the header: F800).

    • Why: If an F pops up mid-program, the laser will drop its speed down to a crawl (e.g., the old F60 plunge rate from the mill) and instantly burn through the copper/textolite.
  • 🔍 Search for S $\rightarrow$ Exactly 1 match (only in the header: S800).

    • Why: Extra S commands in the program body will cause the laser to spontaneously change its power output right along the tracks.

4. Footer (Locking Zero for Program Changes)

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 X and Y coordinates, and M03 / M05 commands. Everything else goes to the bin.

About

Convert CNC milling G-code into laser engraving G-code.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors