<p>I don't think you're going to find either a firmware feature or a slicer feature that handles specifically what you want to do. The slicer would probably be the best place to put it, and I'd recommend maybe opening a feature request ticket with Ultimaker, because that sounds like an awesome feature.</p>

<p>That being said, there's nothing stopping you from post-processing your GCode file after it's been generated. If you're experienced with python at all, that's the place I'd recommend you start.</p>

<p>You'll probably want to do it via the following:</p>

<ol>
<li>Find the first line number that does a retraction.</li>
<li>Sum up all the extrusion distances between that line and the starting point (the beginning of the file)</li>
<li>Replace the retraction distance and feedrate with whatever your short/medium/long retraction settings are</li>
<li>Store that line number as your new starting point</li>
<li>GOTO 1.</li>
</ol>

<p>If you're using Slic3r, there's actually a post-processing script function built into the app itself, you just need to write the script and give it to the application to make the whole process hands-off. For other slicers you'll probably just have to run the script manually between slicing and printing.</p>

CC BY-SA 4.0
2019-07-22T15:18:47.350Z
Wow, I didn't know that Slic3r implemented that kind of thing.  I'll check into it!  Just thinking out loud here - Slic3r is completely separate from Prusa's experimentation with it, e.g. PrusaSlicer.  So I would be working with Slic3r, not necessarily PrusaSlicer, unless Prusa has implemented this as well.


I think the way I would do it would be to insert some sort of comment using the slicer like "Insert long/medium/short retract here," and then use the post-processing script to fill in the gaps.
TempleGuard527
CC BY-SA 4.0
2019-06-02T03:41:53.783Z
2019-06-02T03:41:53.783Z
Nach0z
<p>I have a Rostock Max V2, and I've added a second extruder going into a y-splitter into a single nozzle on my printer. I have both extruders working correctly, but I'm having trouble tuning the retraction settings to prevent stringing when I switch between extruders during a print.  My system is essentially identical to the setup seen <a href="https://www.youtube.com/watch?v=A_a9GofByKY" rel="nofollow noreferrer">here</a>.  However, I can't get my printer to retract as cleanly as the one in the video</p>

<p>What I'm trying to avoid is the long, thin "tail" that forms when retracting the filament from the hot end. That "tail" binds the other filament during the switch and makes the extruder grind a hollow spot on the filament.</p>

<p>I've had limited success tuning my retraction settings, but I find that I need different settings for different extrusion speeds. For example, after an extrusion like <code>G1 E20 F240</code> a 3mm retraction, 3mm extrusion, then a fast retraction creates a nice, clean break (this routine is recommended <a href="http://forum.seemecnc.com/viewtopic.php?f=41&amp;t=11693" rel="nofollow noreferrer">here</a> by kraeger on the SeeMeCNC forums). However, after an extrusion like <code>G1 E20 F900</code> I have to use longer  retractions to get a clean break.  I think this might have to do with the filament acting like a spring inside the bowden tube. It would make sense to me that the harder you push the filament, the more you need to pull back to compensate for the pent-up spring force.</p>

<p>Here's my question:  Is there a way to read the value of the extrusion speed, essentially the "F" term from the gcode commands, and change my retraction routine accordingly.</p>

<p>Example pseudocode:</p>

<pre><code>If F value &lt; 500 Then do short retraction
If F value &gt; 500 AND F value &lt; 1000 Then do medium retraction
If F value &gt; 1000 Then do long retraction
</code></pre>

<p>I'm using the tool change script feature in Simplify3D to store the tool change code.</p>

<extrusion><simplify3d><multi-material><retraction>
Use Gcode Extrusion Speed in Calculations
TempleGuard527
# Use Gcode Extrusion Speed in Calculations

(Asked by: username_0 on 2019-02-08)

I have a Rostock Max V2, and I've added a second extruder going into a y-splitter into a single nozzle on my printer. I have both extruders working correctly, but I'm having trouble tuning the retraction settings to prevent stringing when I switch between extruders during a print. My system is essentially identical to the setup seen [here](https://www.youtube.com/watch?v=A_a9GofByKY). However, I can't get my printer to retract as cleanly as the one in the video

What I'm trying to avoid is the long, thin "tail" that forms when retracting the filament from the hot end. That "tail" binds the other filament during the switch and makes the extruder grind a hollow spot on the filament.

I've had limited success tuning my retraction settings, but I find that I need different settings for different extrusion speeds. For example, after an extrusion like `G1 E20 F240` a 3mm retraction, 3mm extrusion, then a fast retraction creates a nice, clean break (this routine is recommended [here](http://forum.seemecnc.com/viewtopic.php?f=41&t=11693) by kraeger on the SeeMeCNC forums). However, after an extrusion like `G1 E20 F900` I have to use longer retractions to get a clean break. I think this might have to do with the filament acting like a spring inside the bowden tube. It would make sense to me that the harder you push the filament, the more you need to pull back to compensate for the pent-up spring force.

Here's my question: Is there a way to read the value of the extrusion speed, essentially the "F" term from the gcode commands, and change my retraction routine accordingly.

Example pseudocode:

```
If F value < 500 Then do short retraction
If F value > 500 AND F value < 1000 Then do medium retraction
If F value > 1000 Then do long retraction

```

I'm using the tool change script feature in Simplify3D to store the tool change code.

**Tags:** extrusion, simplify3d, multi-material, retraction


---

## 1 answers

### Answer by username_1 on 2019-06-02. Score: 0 | Accepted answer

I don't think you're going to find either a firmware feature or a slicer feature that handles specifically what you want to do. The slicer would probably be the best place to put it, and I'd recommend maybe opening a feature request ticket with Ultimaker, because that sounds like an awesome feature.

That being said, there's nothing stopping you from post-processing your GCode file after it's been generated. If you're experienced with python at all, that's the place I'd recommend you start.

You'll probably want to do it via the following:

1. Find the first line number that does a retraction.
2. Sum up all the extrusion distances between that line and the starting point (the beginning of the file)
3. Replace the retraction distance and feedrate with whatever your short/medium/long retraction settings are
4. Store that line number as your new starting point
5. GOTO 1.

If you're using Slic3r, there's actually a post-processing script function built into the app itself, you just need to write the script and give it to the application to make the whole process hands-off. For other slicers you'll probably just have to run the script manually between slicing and printing.

> **Comments:**
> **username_0**: Wow, I didn't know that Slic3r implemented that kind of thing.  I'll check into it!  Just thinking out loud here - Slic3r is completely separate from Prusa's experimentation with it, e.g. PrusaSlicer.  So I would be working with Slic3r, not necessarily PrusaSlicer, unless Prusa has implemented this as well.   I think the way I would do it would be to insert some sort of comment using the slicer like "Insert long/medium/short retract here," and then use the post-processing script to fill in the gaps.  

---

