First layer Z-offset in G-code

In slicer G-code is it possible to set the probe Z offset for the first layer only?

For my stock E3 plate I find -4.125 mm best however for glass I need to go to -4.175 mm for the first layer to get better adhesion. So it's a manual process every time. Any way to tell the slicer do the first layer at -4.175 mm and next ones at -4.125 mm?

• Are you running stock firmware/Marlin firmware?
– 0scar
Apr 7 at 17:48

I don't understand the reasoning behind a first layer having a different offset from the following layers, but, You can manually add a re-definition of the current height after the first layer, suppose your first layer is 0.2 mm, you just need to tell the printer to move to a slightly higher next layer to redefine this as a different Z-offset.

• From a G-code file find the start of the second layer:
G0 F600 X141.541 Y109.467 Z0.37
• Modify this to:
G0 F600 X141.541 Y109.467 Z0.42
• Now insert the following command:
G92 X0.37

Now it is like you have changed the Z-offset.

The reason for not using M206 is that is applied onto current offsets, if you accidentally save setting to memory after printing, it stores this offset. You can use M206, but use it carefully. A re-definition of the Z level is never stored, the next G28 erases the effect, so does repowering the motors.

• Hm I cannot find G0 in PrusaSlicer printer settings G-code. Mine goes M420 than G1 Z2 F240.. Also is this just changing the layer heigh or actual Z offset ? I just found out about M206 documentation says it can set the Z offset for the first layer but what is used after the setting on the printer or ? Apr 3 at 9:52
• @SterlingDuchess G1 is identical to G0 for e.g. Marlin and RepRap firmware. I wouldn't recommend using M206.
– 0scar
Apr 3 at 13:46
• @ster Check out this site for a good Gcode reference. It lists G0 as an alias for G1 and says it is best practice to use it as a non extrusion move command. Apr 4 at 16:59
• @Rykara It would be better to point people to the RepRap G-code reference, this site is not firmware specific but targets more firmware flavors. But, thanks for the addition, I've updated my comment.
– 0scar
Apr 7 at 13:12

Trying to change the Z level (NOT the offset) during a print isn't a good idea UNLESS you know that all future moves will be "relative".

The M206 (if you use Marlin) is the right way to set it! Depending on the slicer, just create TWO "different" printer definitions and add them to the startup G-codes.

If you don't save it, a reset will return the z-offset to the "saved" value. Or consider resetting to a "standard" value in the ending G-code.

Also, consider using "baby-stepping" (if you can), and manually adjusting things at the start of a print with a different surface.

• Welcome to 3D Printing SE and thank you for your contribution. When you get a chance, please take the Tour to understand how the site works and how it is different than others. Apr 4 at 3:14