Don’t have a file as such I can share so I’ll walk you through it.
Simple project, mark a single, 5mm x 5mm square using a single pass. Design in Easel using a 0.1mm DOC and make the material 0.1mm, that’ll give you a single pass. Set your automatic spindle control to request 18,000rpm (which gives full duty cycle on the PWM output). Then export the gcode.
This gives me this:
G21
G90
G1 Z3.810 F228.6
M3 S18000
G1 Z3.810 F228.6
G0 X10.000 Y10.000
G1 Z-0.100 F228.6
G1 X10.000 Y10.000 F200.0
G1 X5.000 Y10.000 F200.0
G1 X5.000 Y5.000 F200.0
G1 X10.000 Y5.000 F200.0
G1 X10.000 Y10.000 F200.0
G1 Z3.810 F228.6
M5
G0 X0.000 Y0.000
Looks good, will go set machine to mm units, go to safety height (3.81mm), turn on the spindle, move to top right of the square, lower to 0.1mm below your set zero point and then start carving. At the end of the cut, it’ll go back to safety height, turn off the spindle then return to zero in the X,Y.
First of all you want to remove all you spindle switch on commands. Simple search and delete all of these entries:
M3 S180000
This should make your gcode look like this:
G21
G90
G1 Z3.810 F228.6
G1 Z3.810 F228.6
G0 X10.000 Y10.000
G1 Z-0.100 F228.6
G1 X10.000 Y10.000 F200.0
G1 X5.000 Y10.000 F200.0
G1 X5.000 Y5.000 F200.0
G1 X10.000 Y5.000 F200.0
G1 X10.000 Y10.000 F200.0
G1 Z3.810 F228.6
M5
G0 X0.000 Y0.000
Then search and replace on all Z moves to safety height and changes them to spindle off commands. So replace:
G1 Z3.810 F228.6
with:
M5
giving your gcode now looking like this:
G21
G90
M5
M5
G0 X10.000 Y10.000
G1 Z-0.100 F228.6
G1 X10.000 Y10.000 F200.0
G1 X5.000 Y10.000 F200.0
G1 X5.000 Y5.000 F200.0
G1 X10.000 Y5.000 F200.0
G1 X10.000 Y10.000 F200.0
M5
M5
G0 X0.000 Y0.000
This gives duplicate M5 commands but does no harm. If you don’t like it you can always go through and remove duplicate commands.
Final step is to search and replace on Z downwards movements to -0.1mm to switch the spindle (laser) on. Search and replace on your step down commands, in my case 0.1mm.
Search for:
G1 Z-0.100 F228.6
replace with:
M3 S18000
This gives you a final gcode looking like this:
G21
G90
M5
M5
G0 X10.000 Y10.000
M3 S18000
G1 X10.000 Y10.000 F200.0
G1 X5.000 Y10.000 F200.0
G1 X5.000 Y5.000 F200.0
G1 X10.000 Y5.000 F200.0
G1 X10.000 Y10.000 F200.0
M5
M5
G0 X0.000 Y0.000
This job, when sent will move the laser to the top right corner of the square, turn on the laser, mark the full square, turn off the laser and return to X0, Y0. (No Z movements at all, so you don’t need to set zero/focus again if you decide you want to run it again to make it darker. It sounds a lot more complicated than it actually is.
Obviously, with cutting, you’ll probably need to do multiple passes but the same principles apply.
Hope that helps
Ian