<h2>Placeholders</h2>
<p>I don't know if you are familiar with the <a href="https://github.com/prusa3d/PrusaSlicer/wiki/Slic3r-placeholders-(a-copy-of-the-mauk.cc-page)" rel="nofollow noreferrer">concept of placeholders</a>? PrusSlicer is a derivative of Slic3r which uses this concept to insert <a href="https://github.com/prusa3d/PrusaSlicer/wiki/Slic3r-Prusa-Edition-Macro-Language" rel="nofollow noreferrer">placeholders</a> (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.</p>
<p>Unfortunately, although there is a constant for the filament type (<code>filament_type</code>), 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.</p>
<p>E.g.</p>
<pre><code>{if printer_notes=~/.*PRINTER_VENDOR_PRUSA3D.*/};Printer is Prusa{endif}
M117 [filament_type]
</code></pre>
<p>evaluates fine, but</p>
<p><code>{if filament_type=~/.*PLA.*/};Filament type is PLA{endif}</code></p>
<p>does not evaluate fine...</p>
<p><a href="https://i.sstatic.net/GtBKe.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/GtBKe.png" alt="enter image description here" /></a></p>
<p>Solving this using placeholders, the printing temperatures for PLA and PETG are different, so in a conditional statement of the <code>first_layer_temperature</code> you could add an additional offset to the code at the end of the start G-code.</p>
<h2>Start G-code</h2>
<p>A place to do this is the filament dependent start G-code section:</p>
<p><a href="https://i.sstatic.net/JLhUL.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/JLhUL.png" alt="enter image description here" /></a></p>
<p>You can always edit this start G-code to include a manually set offset by moving the printer to a certainly height:</p>
<p><code>G1 Z0.15</code></p>
<p>and then redefining the zero level</p>
<p><code>G92 Z0</code></p>
<h2>Printer Z-offset</h2>
<p>Note that a <code>z_offset</code> 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 <code>z-offset</code> option is part of the &quot;printer settings&quot; interface. This extra offset is added to the initial layer height movement.</p>
<p><a href="https://i.sstatic.net/romz3.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/romz3.png" alt="enter image description here" /></a></p>

CC BY-SA 4.0
2020-04-04T06:57:45.230Z
2020-04-07T13:27:30.880Z
2020-06-18T08:29:41.667Z
0scar
<p>If your environment supports it, you can also use a G54 to add a constant offset to any positioning. So, you could use:</p>

<pre><code>G53 ; clear offsets  
G54 Z0.15 ; add 0.15mm to every Z position
</code></pre>

<p>Just remember to clear the offsets at the end of your gcode:</p>

<pre><code>G53 ; clear offsets
</code></pre>

CC BY-SA 4.0
2020-06-09T15:22:10.723Z
2020-06-09T15:22:10.723Z
Davo
<p>My printer is calibrated for a certain clearance from the heated bed, which is chosen based on PLA.</p>

<p>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. </p>

<p>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.</p>

<p>How can I do that?</p>

CC BY-SA 4.0
2020-04-03T17:56:30.470Z
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
<g-code><adhesion><petg>
How can I add an offset to the first layer to increase clearance?
FarO
# How can I add an offset to the first layer to increase clearance?

(Asked by: username_0 on 2020-04-03)

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?

**Tags:** g-code, adhesion, petg
> **Comments:**
> **username_1**: 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.  

---

## 2 answers

### Answer by username_1 on 2020-04-04. Score: 1 | Accepted answer

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.


---

### Answer by username_2 on 2020-06-09. Score: 1

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


---

