# How can I add an offset to the first layer to increase clearance?

My printer is calibrated for a certain clearance from the heated bed, which is chosen based on PLA.

I would like to try to increase it for the first layer for PETG, so that adhesion is reduced. The printer has M5 screws with 4000 steps/mm, so the resolution clearly allows that.

I don't want to modify the printer, I would like a G-Code or another option that I can apply in Prusa slicer in association with the specific filament when desired. I don't want to change the flow rate of the first layer, only the "zero" distance.

How can I do that?

• In Cura it is easy, there is a Z offset option after you install a plug-in. To be honest, I print mostly PETG, but PLA with the same printer without making any offset changes. – 0scar Apr 3 '20 at 17:56

## Placeholders

I don't know if you are familiar with the concept of placeholders? PrusSlicer is a derivative of Slic3r which uses this concept to insert placeholders (sort of constants, with the possibility to do arithmetic) into your G-code (e.g. start or end codes) which are evaluated just before the slicer generates the final G-code upon slicing.

Unfortunately, although there is a constant for the filament type (filament_type), you cannot use a conditional expression as this does not work on string comparison (which should work with regular expressions...), but with some imagination you can fabricate a way to get past this problem.

E.g.

{if printer_notes=~/.*PRINTER_VENDOR_PRUSA3D.*/};Printer is Prusa{endif}
M117 [filament_type]


evaluates fine, but

{if filament_type=~/.*PLA.*/};Filament type is PLA{endif}

does not evaluate fine...

Solving this using placeholders, the printing temperatures for PLA and PETG are different, so in a conditional statement of the first_layer_temperature you could add an additional offset to the code at the end of the start G-code.

## Start G-code

A place to do this is the filament dependent start G-code section:

You can always edit this start G-code to include a manually set offset by moving the printer to a certainly height:

G1 Z0.15

and then redefining the zero level

G92 Z0

## Printer Z-offset

Note that a z_offset constant exists, so it is configurable in the graphical interface, if so, than I assume this fixes your problem instantly as the offset is directly applied in the final G-code. The z-offset option is part of the "printer settings" interface. This extra offset is added to the initial layer height movement.

• Maybe you missed a dot before the second asterisk, have you tried this? {if filament_type=~/.*PLA.*/};Filament type is PLA{endif} – FarO Apr 7 '20 at 13:06
• @FarO Indeed I missed this (working on laptop at home == small screen) but that does not matter, it still does not work. – 0scar Apr 7 '20 at 13:28

If your environment supports it, you can also use a G54 to add a constant offset to any positioning. So, you could use:

G53 ; clear offsets
G54 Z0.15 ; add 0.15mm to every Z position


Just remember to clear the offsets at the end of your gcode:

G53 ; clear offsets