Marlin Gcode on successive cuts

I am using light burn for a surface engraving (cut+scan) and then to cut out the piece on 3mm plywood. What it looks like is 12 circles that have names engraved and then the circles are cut out. I do it all in the same job. The scan+cut is set up with a Z offset of 2.00 mm and a single pass. The cut operation also uses a Z offset of 2.00 mm, with 9 passes and a Z step of 0.25mm per pass. I use the Z offset because I have a spacer to set the height of my laser but it needs to move 2 mm down for it to be in focused optimally on the surface of the plywood.

Even though I have tested the above settings on a single circle and had the proper results, when I do all twelve, the laser will not make it all the way through the plywood. I looked at the gcode and I think I figured it out. Looking at the cut gcode, line 24000, Z rises 2 mm then drops 2mm, there are nine passes of cutting (8 dropping 0.25mm each), total drop of 4mm. Then Z rises 4mm and the cycle starts again by dropping Z 2mm.

Z axis looks like this (exert from the gcode)
Command <--------------> Absolute Z Position
G0 Z2 <---------------> 2mm (initial start of a circle cut)
G0 Z-2 <---------------------> 0mm
G0 Z-0.25 (8 X -0.25MM) = 4mm <--------> - 4mm
G0 Z4 <-----------------> 0mm (circle cut finished)
G0 Z-2 <----------------> - 2mm (start of next circle cut)
G0 Z-0.25 (8 X -0.25MM) = 4mm <--------> - 6mm
G0 Z4 <-----------------> - 2mm (circle cut finished)
G0 Z-2 <----------------> - 4mm (start of next circle cut)
G0 Z-0.25 (8 X -0.25MM) = 4mm<--------> - 8mm
G0 Z4 <-----------------> - 4mm (circle cut finished)

On each successive circle cut I loose 2mm height which results in the laser not being focused optimally and does not cut the plywood.

Included the lightburn file but I am not sure if it will generate the same output as I have so I have attached the gcode file, changed the extension so it would upload, change it back to .gc.

Is any one able to verify if my interpretation of the gcode is correct?

test.lbrn (1.1 MB)

gcode.lbrn (587.3 KB)

I modified your file a little, to make 10 narrow copies of the squares so it was easier to see, and ran the code through this online GCode simulator: https://nraynaud.github.io/webgcode/

It does not appear to be losing height - I think it’s just that you’ve entered a material height of 3mm in the project, so your starting Z value is 3mm, less the 2mm offset. If you set the software to run with “Relative Z Moves Only” it ignores the material height setting and just runs all Z moves relative to the starting Z height, instead of using the material height value as the initial Z.

I selected “Relative Z moves only” and took out the material height. Regenerated the code and I still see it loosing height. Ran it through the simulator and it looks ok but reading the code I do not see it. It still rises 4mm after every copy and drops 2mm at the start, losing 2mm per copy. There is no G90 in the code. I must be missing something.

I don’t think that’s correct. The Z offset of -2 happens at the start, and then each cut takes off another -0.25. 8 steps makes that another -2mm. The G0 Z4 at the end compensates for both, and the process starts again. I changed the circles to squares to emit less GCode, but the settings are identical:

(scroll this window to see the full contents)

; Cut @ 10 mm/sec, 100% power
M106 S0 
G0 X-3.17 Y10 F0   ; move to the start of the cut
G0 Z-2             ; initial Z offset of -2
G0
M106 S255          ; power on
G1 X24 F600        ; first cut
G1 Y-24.81
G1 X-24
G1 Y24.81
M106 S0            ; power off
G0 Z-0.25          ; step down (now at -2.25)
M106 S255
G1 X24
G1 Y-24.81
G1 X-24
G1 Y24.81
M106 S0 
G0 Z-0.25          ; step down (now at -2.50)
M106 S255
G1 X24
G1 Y-24.81
G1 X-24
G1 Y24.81
M106 S0 
G0 Z-0.25          ; step down (now at -2.75)
M106 S255
G1 X24
G1 Y-24.81
G1 X-24
G1 Y24.81
M106 S0 
G0 Z-0.25          ; step down (now at -3.00)
M106 S255
G1 X24
G1 Y-24.81
G1 X-24
G1 Y24.81
M106 S0 
G0 Z-0.25          ; step down (now at -3.25)
M106 S255
G1 X24
G1 Y-24.81
G1 X-24
G1 Y24.81
M106 S0 
G0 Z-0.25          ; step down (now at -3.50)
M106 S255
G1 X24
G1 Y-24.81
G1 X-24
G1 Y24.81
M106 S0 
G0 Z-0.25          ; step down (now at -3.75)
M106 S255
G1 X24
G1 Y-24.81
G1 X-24
G1 Y24.81
M106 S0 
G0 Z-0.25          ; step down (now at -4.00)
M106 S255
G1 X24
G1 Y-24.81
G1 X-24
G1 Y24.81
M106 S0 
G0 Z4              ; step up 4mm (back to 0.00)
M106 S0            ; power off

G0 X-11 Y0 F0      ; move to next cut
G0 Z-2             ; initial offset (now at -2.00)

… and so on.

Oops. 8 x 0.25 = 2 not 4 !!!

I’m going to delete the topic, since there’s no bug here. :slight_smile: