<p>Cura now has a <strong>setting &quot;Wipe Nozzle Between Layers&quot;</strong>, located in the Experimental settings group. it requires the installation of a wipe brush or wipe surface that is fixed to the x axis at a certain x position and moves with it the y and z directions. You can find suitable 3D printable <a href="https://www.thingiverse.com/search?q=nozzle%20brush" rel="nofollow noreferrer">nozzle brush holders</a> for most 3D printers.</p>
<p>It does more or less exactly what you are looking for, just that you do not specify nozzle cleaning intervals &quot;every Xth layer or every one minute&quot; as you want but by print volume – see sub-setting &quot;Material Volume Between Wipes&quot;. B setting this to a very small value, you can however force a wipe after every single layer, as that is the hardcoded maximum number of wipes that this setting will generate.</p>
<p>For a good article explaining the setting in depth, see &quot;<a href="https://the3dprinterbee.com/cura-wipe-nozzle-between-layers/" rel="nofollow noreferrer">Cura Wipe Nozzle Between Layers</a>&quot; by Martin Lütkemeyer.</p>

CC BY-SA 4.0
2023-05-18T14:42:19.040Z
2023-05-18T14:42:19.040Z
tanius
<p>There are extensions for Cura that can do almost what you want to do for you (with respect to the layer or height).</p>
<p>You need to add post-processing scripts to the Cura slicer. You do that from the top menu options <code>Extensions -&gt; Post Processing -&gt; Modify G-Code</code> and then add the option of choice.</p>
<p>E.g. for an event at every layer change you should use script &quot;<em>Insert at layer change</em>&quot; and fill out the G-code you want to perform.</p>
<p>There are options to write your own extension, but that would require some software development skills.</p>
<p>Optionally, you could use the &quot;ChangeAtZ&quot; script to add absurd temperature changes of the extruder to post process that later by a simple e.g. Python script (outside Cura) to replace those actions with the cleaning actions you want to perform. But, when you can do that, you could write a script outside Cura to detect the layers (e.g. from the comments or from the layer change command <code>G1 Zxx</code>) and insert that right away.</p>
<p>For inserting this on the basis of time would be very difficult, it is difficult to estimate the time printing actions take to then inject such a script.</p>

CC BY-SA 4.0
2022-12-10T15:32:15.083Z
If you want to add markers, just add comments instead of adding absurd temperature changes.
fectin
CC BY-SA 4.0
2022-12-10T23:25:08.563Z
@fectin That script won't add solely comments, so inserting a absurd/strange/"other than the used" temperature is a viable solution I've used in the past.
0scar
CC BY-SA 4.0
2022-12-11T18:35:15.403Z
ahh, gotcha. Maybe use one of the statuses instead, like M113? Or a beep with M300?
fectin
CC BY-SA 4.0
2020-11-15T19:06:18.007Z
2020-11-15T19:06:18.007Z
0scar
<p>I want to make a G-code script for Cura to clean the nozzle every Xth layer or every one minute?</p>
<p>With Cura there is only start and end G-code, so there is no &quot;layer change&quot; G-code like another slicer (e.g. Ideamaker).</p>
<p>Where should I write the code?</p>
<p>How can I define the Layer number?</p>

CC BY-SA 4.0
2020-11-15T17:32:46.757Z
just as a side note. Is this something that you would want your printer to do automatically without needing to resort to g-code modifications? I'm asking.. er... for a "friend".
user77232
CC BY-SA 4.0
2020-12-14T15:07:00.213Z
yes the Printer should do this automatically, you have to write the G-code in the Slicer (Cura) and every time you  slice the written G-code will be automatic there! sometimes you have to be careful, if you change the Template the Orginal G-code will be used! just look if you still have the same G-code!
Quteiba ALsalaa
CC BY-SA 4.0
2021-08-15T16:55:28.570Z
Not an answer, but if your nozzle is getting dirty during your print, it means there is a significant amount of material that came out of the extruder that **did not bond where it was supposed to**. This means the part was not printed right, and does not have the structural properties it should. You should probably try to figure out why that's happening and fix it, and if you do, you'll probably find that you no longer need to clean the nozzle.
R.. GitHub STOP HELPING ICE
<ultimaker-cura><g-code>
Cleaning the nozzle every Xth layer G-code
Quteiba ALsalaa
# Cleaning the nozzle every Xth layer G-code

(Asked by: username_0 on 2020-11-15)

I want to make a G-code script for Cura to clean the nozzle every Xth layer or every one minute?

With Cura there is only start and end G-code, so there is no "layer change" G-code like another slicer (e.g. Ideamaker).

Where should I write the code?

How can I define the Layer number?

**Tags:** ultimaker-cura, g-code

> **Comments:**
> **username_1**: just as a side note. Is this something that you would want your printer to do automatically without needing to resort to g-code modifications? I'm asking.. er... for a "friend".  
> **username_0**: yes the Printer should do this automatically, you have to write the G-code in the Slicer (Cura) and every time you  slice the written G-code will be automatic there! sometimes you have to be careful, if you change the Template the Orginal G-code will be used! just look if you still have the same G-code!  
> **username_2**: Not an answer, but if your nozzle is getting dirty during your print, it means there is a significant amount of material that came out of the extruder that **did not bond where it was supposed to**. This means the part was not printed right, and does not have the structural properties it should. You should probably try to figure out why that's happening and fix it, and if you do, you'll probably find that you no longer need to clean the nozzle.  

---

## 2 answers

### Answer by username_3 on 2023-05-18. Score: 1

Cura now has a **setting "Wipe Nozzle Between Layers"**, located in the Experimental settings group. it requires the installation of a wipe brush or wipe surface that is fixed to the x axis at a certain x position and moves with it the y and z directions. You can find suitable 3D printable [nozzle brush holders](https://www.thingiverse.com/search?q=nozzle%20brush) for most 3D printers.

It does more or less exactly what you are looking for, just that you do not specify nozzle cleaning intervals "every Xth layer or every one minute" as you want but by print volume – see sub-setting "Material Volume Between Wipes". B setting this to a very small value, you can however force a wipe after every single layer, as that is the hardcoded maximum number of wipes that this setting will generate.

For a good article explaining the setting in depth, see "[Cura Wipe Nozzle Between Layers](https://the3dprinterbee.com/cura-wipe-nozzle-between-layers/)" by Martin Lütkemeyer.


---

### Answer by username_4 on 2020-11-15. Score: 0

There are extensions for Cura that can do almost what you want to do for you (with respect to the layer or height).

You need to add post-processing scripts to the Cura slicer. You do that from the top menu options `Extensions -> Post Processing -> Modify G-Code` and then add the option of choice.

E.g. for an event at every layer change you should use script "*Insert at layer change*" and fill out the G-code you want to perform.

There are options to write your own extension, but that would require some software development skills.

Optionally, you could use the "ChangeAtZ" script to add absurd temperature changes of the extruder to post process that later by a simple e.g. Python script (outside Cura) to replace those actions with the cleaning actions you want to perform. But, when you can do that, you could write a script outside Cura to detect the layers (e.g. from the comments or from the layer change command `G1 Zxx`) and insert that right away.

For inserting this on the basis of time would be very difficult, it is difficult to estimate the time printing actions take to then inject such a script.

> **Comments:**
> **username_5**: If you want to add markers, just add comments instead of adding absurd temperature changes.  
> **username_4**: @username_5 That script won't add solely comments, so inserting a absurd/strange/"other than the used" temperature is a viable solution I've used in the past.  
> **username_5**: ahh, gotcha. Maybe use one of the statuses instead, like M113? Or a beep with M300?  

---

