<p><strong>To answer your first question</strong>:</p>

<p>Your calculations are not wrong, they are correct for a <strong>normal layer</strong> (uncorrected) layer. These calculations should get you very near the solution. The problem is that there are <strong>default modifiers at play</strong> that modify the extrusion process which become apparent when you change them or look at the hoover hint in the advanced printer settings section. E.g. see the image below of the "Print Settings" graphical user interface; specifically look at the hoovering hint:</p>

<p><a href="https://i.sstatic.net/eUGy7.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/eUGy7.png" alt="Slic3r Print Settings GUI"></a></p>

<p>The hoovering hint tells you that there is a 200&nbsp;% modifier at play. <strong><em>What! a default modifier without me knowing?</em></strong> Well...., if we had looked at the 
Slic3r Manual (<a href="https://manual.slic3r.org/first-print/first-layer" rel="nofollow noreferrer">The Important First Layer</a>) a little better, we read that:</p>

<blockquote>
  <p><strong>Fatter extrusion width.</strong> <br>The more material touching the bed, the better
  the object will adhere to it, and this can be achieved by increasing
  the extrusion width of the first layer, either by a percentage or a
  fixed amount. Any spaces between the extrusions are adjusted
  accordingly.</p>
  
  <p>A value of approximately 200&nbsp;% is usually recommended, but note that
  the value is calculated from the layer height and so the value should
  only be set if the layer height is the highest possible. For example,
  if the layer height is 0.1&nbsp;mm, and the extrusion width is set to 200&nbsp;%,
  then the actual extruded width will only be 0.2&nbsp;mm, which is smaller
  than the nozzle. This would cause poor flow and lead to a failed
  print. It is therefore highly recommended to combine the high first
  layer height technique recommended above with this one. Setting the
  first layer height to 0.35&nbsp;mm and the first extrusion width to 200&nbsp;%
  would result in a nice fat extrusion 0.65&nbsp;mm wide.</p>
</blockquote>

<p>Tada! There we have the modifier from the screenshot; 200&nbsp;% (this is expressed as a percentage over the layer height, and causes that an additional filament scale factor bigger than 1 is at play; the <span class="math-container">$x$</span> in your equations).</p>

<p><strong>To answer the second question</strong>:</p>

<p>That should be rather straight forward, you know how long the path is and at which speed the head is moving (either at constant speed, decelerating or accelerating) and how much of filament you need to deposit, at the end point all filament needs to be deposited so you can calculate how fast the extrusion needs to be to accomplish that.</p>

<hr>

<p><em>If you calculate back from a volume of 8.214 mm<sup>2</sup> and solve for unknown <span class="math-container">$w$</span> you see that this yields <span class="math-container">$ w = 0.65\ mm $</span>, and that is exactly what is stated as first layer width in your Slic3r settings; I quote:</em></p>

<blockquote>
  <p>first_layer_extrusion_width = 0.65</p>
</blockquote>

<hr>

<p><em>P.S. When you look into the source code of <a href="https://github.com/slic3r/Slic3r" rel="nofollow noreferrer">Slic3r</a>, if you dig deep, you find that extrusion width is bound by minimum and maximum values, it could well be that that is causing the value to differ from 0.70 mm (200 % of 0.35).</em></p>

CC BY-SA 4.0
2019-06-05T20:11:46.370Z
Excellent..! :-)
Greenonline
CC BY-SA 4.0
2019-06-05T20:42:41.253Z
Very nice. I know it's a quote, but... "Setting the first layer height to 0.35 mm and the first extrusion width to 200 % would result in a nice fat extrusion 0.65 mm wide." - gets out calculator...
Davo
CC BY-SA 4.0
2019-06-05T20:59:01.267Z
@Davo Yep, my HP-48 G says 0.70, please don't shoot the messenger ;)
0scar
CC BY-SA 4.0
2019-06-07T16:44:34.983Z
@0scar Thank you for the explanation. The calculations match up when I use extrusion width = 0.65mm. I checked my slic3r config (edited my original question to add the picture). I am using a config from Prusa for 0.6 mm nozzle. Although its not set to auto, the value still corresponds to 200% (default). What was throwing me off was that the lines of g-code in my question correspond to external perimeter and there is a specific value for external perimeter width for external perimeters (0.61 mm). Does, the "first layer" width overrides the perimeter width too?
Rock
CC BY-SA 4.0
2019-06-07T18:47:33.870Z
@Rock Yes first layer overrides other settings.
0scar
CC BY-SA 4.0
2019-06-07T19:00:42.327Z
@0scar can you give me an example for the second part of the question that you answered above? Maybe use a trapezoid velocity profile for this?
Rock
CC BY-SA 4.0
2019-06-07T20:13:42.033Z
@Rock A trapezoid profile is not possible, it is constant, accelerating or decelerating, there are no other options. I'll update the answer with an example.
0scar
CC BY-SA 4.0
2019-06-10T21:06:51.427Z
@0scar doesn't the trapezoid velocity profile contain all the three segements (accelerating, constant and decelerating) you mentioned? . . . waiting for the answer for second part of the question
Rock
CC BY-SA 4.0
2019-06-05T18:35:05.763Z
2019-06-06T11:21:11.010Z
2019-06-06T11:21:11.010Z
0scar
<p>I want to know the math behind how Slic3r calculates E values. <span class="math-container">$E_{value}$</span> represents amount of filament in mm (unless volumetric extrusion is selected) that has to be fed into the hotend to obtain a road of specific extrusion width.</p>

<p>Consider an example with following parameters: </p>

<ul>
<li>Nozzle diameter = 0.6 mm </li>
<li>Layer height = 0.35 mm </li>
<li>Extrusion width = 0.61 mm (for external perimeter) </li>
<li>Length of the line segment (distance of the deposition path) = 98.2 mm </li>
<li>Diameter of filament = 1.75 mm</li>
</ul>

<p><strong>First part of the question</strong>: How is <span class="math-container">$E_{value}$</span> calculated for this case? </p>

<p><strong>Second part of the question</strong>: How is velocity of extruder motor calculated for this case?</p>

<p>The Slic3r manual has limited information on flow math but is not comprehensive.</p>

<p>Let's assume volume of plastic fed in equal volume of plastic comes out</p>

<p><span class="math-container">$$Volume_{in} = \pi\times{(\frac{d}{2})}^2 \times E \times x = \frac{\pi\cdot d^2}{4}\times E \times x$$</span></p>

<p>Where, </p>

<ul>
<li><span class="math-container">$d$</span> = diameter of the filament</li>
<li><span class="math-container">$x$</span> = extrusion multiplier</li>
<li><span class="math-container">$E$</span> = <span class="math-container">$E_{value}$</span> to solve for</li>
</ul>

<p><span class="math-container">$$Volume_{out} = (A_{road} \times L)$$</span> </p>

<ul>
<li><p>Length of path, <span class="math-container">$L$</span>, is obtained from start and end coordinates</p></li>
<li><p>Area of the road, <span class="math-container">$A_{road}$</span>, is calculated according to this <a href="https://manual.slic3r.org/advanced/flow-math" rel="noreferrer">link</a> (Slic3r flow math; Section: Extruding on top of a surface). The formula for area of the road according to Slic3r manual is:</p></li>
</ul>

<p><span class="math-container">$$A_{road} = (w - h)\times h + \pi\times{(\frac{h}{2})}^2 $$</span></p>

<p>Where, </p>

<ul>
<li><span class="math-container">$w$</span> = Extrusion width </li>
<li><span class="math-container">$h$</span> = layer height</li>
</ul>

<p>Seems like I am missing something. Math doesn't yield me same result as Slic3r <span class="math-container">$E$</span> value.</p>

<hr>

<p>Many of you have marked this question duplicate. I know the first question is similar to what has asked before (calculating E value) but the answer doesn't match actual E value in G-code. </p>

<p>Also there is a second question on how to calculate extrusion speed given an E value</p>

<p>I have added G-code from actual Slic3r with the same settings as above to check the math.</p>

<p>The advance extrusion width settings in slic3r are as shown in the picture below:
<a href="https://i.sstatic.net/Vdm10.png" rel="noreferrer"><img src="https://i.sstatic.net/Vdm10.png" alt="enter image description here"></a>
The settings are from a Prusa config for 0.6 mm nozzle</p>

<p>Consider a 100 mm x 100 mm x 5 mm part (X x Y x Z dimensions). Following is the output G-code from Slic3r:</p>

<pre><code>; generated by Slic3r 1.3.0 on 2019-06-04 at 16:36:24

; external perimeters extrusion width = 0.61mm (6.55mm^3/s)

; perimeters extrusion width = 0.65mm (10.54mm^3/s)

; infill extrusion width = 0.70mm (15.25mm^3/s)

; solid infill extrusion width = 0.65mm (8.78mm^3/s)

; top infill extrusion width = 0.60mm (6.43mm^3/s)
</code></pre>

<p>------ Values of parameters defined in Slic3r -------</p>

<ul>
<li>first_layer_acceleration = 1000</li>
<li>first_layer_bed_temperature = 60</li>
<li>first_layer_extrusion_width = 0.65</li>
<li>first_layer_speed = 30</li>
<li>first_layer_temperature = 215</li>
<li>first_layer_height = 0.35</li>
<li>max_print_speed = 100</li>
<li>nozzle_diameter = 0.6 </li>
<li>external_perimeter_extrusion_width = 0.61</li>
</ul>

<p>------ some initialization lines above --------</p>

<pre><code>G1 F1800

G1 X78.400 Y169.100 E8.21483 ; perimeter

**G1 X78.400 Y70.900 E8.21483 ; perimeter**

G1 X176.600 Y70.900 E8.21483 ; perimeter

G1 X176.600 Y169.010 E8.20731 ; perimeter

G1 X177.175 Y169.675 F10800.000 ; move to first perimeter point
</code></pre>

<p>The above code snippet refers to the perimeter of the very first layer in the print. Let us consider the highlighted line in above G-code. According to equations we have above, the values of the variables are:</p>

<ul>
<li><span class="math-container">$d$</span> = 1.75</li>
<li><span class="math-container">$x$</span> = 1</li>
<li><span class="math-container">$E$</span> = <span class="math-container">$E_{value}$</span> to solve for</li>
<li><span class="math-container">$w$</span> = 0.61</li>
<li><span class="math-container">$h$</span> = 0.35</li>
<li><span class="math-container">$L$</span> = 169.100 - 70.900 = 98.2</li>
</ul>

<p>Area of the depositied road is:</p>

<p><span class="math-container">$$A_{road} = (0.61 - 0.35)\times 0.35 + \pi\times{(\frac{0.35}{2})}^2 $$</span>
<span class="math-container">$$A_{road} = 0.187211 mm^2 $$</span></p>

<p>For calculating <span class="math-container">$E_{value}$</span>, We use volume equality</p>

<p><span class="math-container">$$Volume_{in} = Volume_{out}$$</span></p>

<p><span class="math-container">$$E_{value} = \frac{A\times L \times 4} {\pi\times d^2 \times x} = \frac{0.187211 \times 98.2 \times 4} {\pi \times 1.75^2 \times 1} = 7.6432 $$</span>  </p>

<p>The <span class="math-container">$E_{value}$</span> in the G-code is 8.214</p>

<p>This is a big difference isn't it? I know about the die swell effect and expansion of molten plastic at the tip, but there seems to be no uniform compensation factor for this!</p>

CC BY-SA 4.0
2019-06-04T05:23:32.237Z
Slic3r is open-source. You don't have to assume anything.
Mick
CC BY-SA 4.0
2019-06-04T06:28:53.870Z
Closely related to, but not duplicate of [How is the E argument calculated for a given G1 command?](https://3dprinting.stackexchange.com/questions/6289/how-is-the-e-argument-calculated-for-a-given-g1-command)
0scar
CC BY-SA 4.0
2019-06-04T13:48:15.230Z
@Oscar, I saw this post earlier. still the calculations dont match with those of actual values output by slic3r
Rock
CC BY-SA 4.0
2019-06-04T16:57:58.140Z
@Rock It should, I've calculated it before in a different answer, it should match or at least very close as there might be some second order effects in play. You should edit the question with an example piece of G-code from slic3r and your calculation. Then we can verify it, now it is guess work. Bit still, the numbers should add up, fortunately, this isn't rocket science ;). A second order effect is die swell, the lines are thicker than the nozzle size on extrusion, there might be compensations in play.
0scar
<slicing><extrusion><slic3r>
How is E value calculated in Slic3r?
Rock
# How is E value calculated in Slic3r?

(Asked by: username_0 on 2019-06-04)

I want to know the math behind how Slic3r calculates E values. $E\_{value}$ represents amount of filament in mm (unless volumetric extrusion is selected) that has to be fed into the hotend to obtain a road of specific extrusion width.

Consider an example with following parameters:

* Nozzle diameter = 0.6 mm
* Layer height = 0.35 mm
* Extrusion width = 0.61 mm (for external perimeter)
* Length of the line segment (distance of the deposition path) = 98.2 mm
* Diameter of filament = 1.75 mm

**First part of the question**: How is $E\_{value}$ calculated for this case?

**Second part of the question**: How is velocity of extruder motor calculated for this case?

The Slic3r manual has limited information on flow math but is not comprehensive.

Let's assume volume of plastic fed in equal volume of plastic comes out

$$Volume\_{in} = \pi\times{(\frac{d}{2})}^2 \times E \times x = \frac{\pi\cdot d^2}{4}\times E \times x$$

Where,

* $d$ = diameter of the filament
* $x$ = extrusion multiplier
* $E$ = $E\_{value}$ to solve for

$$Volume\_{out} = (A\_{road} \times L)$$

* Length of path, $L$, is obtained from start and end coordinates
* Area of the road, $A\_{road}$, is calculated according to this [link](https://manual.slic3r.org/advanced/flow-math) (Slic3r flow math; Section: Extruding on top of a surface). The formula for area of the road according to Slic3r manual is:

$$A\_{road} = (w - h)\times h + \pi\times{(\frac{h}{2})}^2 $$

Where,

* $w$ = Extrusion width
* $h$ = layer height

Seems like I am missing something. Math doesn't yield me same result as Slic3r $E$ value.

---

Many of you have marked this question duplicate. I know the first question is similar to what has asked before (calculating E value) but the answer doesn't match actual E value in G-code.

Also there is a second question on how to calculate extrusion speed given an E value

I have added G-code from actual Slic3r with the same settings as above to check the math.

The advance extrusion width settings in slic3r are as shown in the picture below:
[![enter image description here](https://i.sstatic.net/Vdm10.png)](https://i.sstatic.net/Vdm10.png)
The settings are from a Prusa config for 0.6 mm nozzle

Consider a 100 mm x 100 mm x 5 mm part (X x Y x Z dimensions). Following is the output G-code from Slic3r:

```
; generated by Slic3r 1.3.0 on 2019-06-04 at 16:36:24

; external perimeters extrusion width = 0.61mm (6.55mm^3/s)

; perimeters extrusion width = 0.65mm (10.54mm^3/s)

; infill extrusion width = 0.70mm (15.25mm^3/s)

; solid infill extrusion width = 0.65mm (8.78mm^3/s)

; top infill extrusion width = 0.60mm (6.43mm^3/s)

```

------ Values of parameters defined in Slic3r -------

* first\_layer\_acceleration = 1000
* first\_layer\_bed\_temperature = 60
* first\_layer\_extrusion\_width = 0.65
* first\_layer\_speed = 30
* first\_layer\_temperature = 215
* first\_layer\_height = 0.35
* max\_print\_speed = 100
* nozzle\_diameter = 0.6
* external\_perimeter\_extrusion\_width = 0.61

------ some initialization lines above --------

```
G1 F1800

G1 X78.400 Y169.100 E8.21483 ; perimeter

**G1 X78.400 Y70.900 E8.21483 ; perimeter**

G1 X176.600 Y70.900 E8.21483 ; perimeter

G1 X176.600 Y169.010 E8.20731 ; perimeter

G1 X177.175 Y169.675 F10800.000 ; move to first perimeter point

```

The above code snippet refers to the perimeter of the very first layer in the print. Let us consider the highlighted line in above G-code. According to equations we have above, the values of the variables are:

* $d$ = 1.75
* $x$ = 1
* $E$ = $E\_{value}$ to solve for
* $w$ = 0.61
* $h$ = 0.35
* $L$ = 169.100 - 70.900 = 98.2

Area of the depositied road is:

$$A\_{road} = (0.61 - 0.35)\times 0.35 + \pi\times{(\frac{0.35}{2})}^2 $$
$$A\_{road} = 0.187211 mm^2 $$

For calculating $E\_{value}$, We use volume equality

$$Volume\_{in} = Volume\_{out}$$

$$E\_{value} = \frac{A\times L \times 4} {\pi\times d^2 \times x} = \frac{0.187211 \times 98.2 \times 4} {\pi \times 1.75^2 \times 1} = 7.6432 $$

The $E\_{value}$ in the G-code is 8.214

This is a big difference isn't it? I know about the die swell effect and expansion of molten plastic at the tip, but there seems to be no uniform compensation factor for this!

**Tags:** slicing, extrusion, slic3r

> **Comments:**
> **username_1**: Slic3r is open-source. You don't have to assume anything.  
> **username_2**: Closely related to, but not duplicate of [How is the E argument calculated for a given G1 command?](https://3dprinting.stackexchange.com/questions/6289/how-is-the-e-argument-calculated-for-a-given-g1-command)  
> **username_0**: @Oscar, I saw this post earlier. still the calculations dont match with those of actual values output by slic3r  
> **username_2**: @username_0 It should, I've calculated it before in a different answer, it should match or at least very close as there might be some second order effects in play. You should edit the question with an example piece of G-code from slic3r and your calculation. Then we can verify it, now it is guess work. Bit still, the numbers should add up, fortunately, this isn't rocket science ;). A second order effect is die swell, the lines are thicker than the nozzle size on extrusion, there might be compensations in play.  

---

## 1 answers

### Answer by username_2 on 2019-06-05. Score: 4 | Accepted answer

**To answer your first question**:

Your calculations are not wrong, they are correct for a **normal layer** (uncorrected) layer. These calculations should get you very near the solution. The problem is that there are **default modifiers at play** that modify the extrusion process which become apparent when you change them or look at the hoover hint in the advanced printer settings section. E.g. see the image below of the "Print Settings" graphical user interface; specifically look at the hoovering hint:

[![Slic3r Print Settings GUI](https://i.sstatic.net/eUGy7.png)](https://i.sstatic.net/eUGy7.png)

The hoovering hint tells you that there is a 200 % modifier at play. ***What! a default modifier without me knowing?*** Well...., if we had looked at the
Slic3r Manual ([The Important First Layer](https://manual.slic3r.org/first-print/first-layer)) a little better, we read that:

> **Fatter extrusion width.**   
> The more material touching the bed, the better
> the object will adhere to it, and this can be achieved by increasing
> the extrusion width of the first layer, either by a percentage or a
> fixed amount. Any spaces between the extrusions are adjusted
> accordingly.
>
> A value of approximately 200 % is usually recommended, but note that
> the value is calculated from the layer height and so the value should
> only be set if the layer height is the highest possible. For example,
> if the layer height is 0.1 mm, and the extrusion width is set to 200 %,
> then the actual extruded width will only be 0.2 mm, which is smaller
> than the nozzle. This would cause poor flow and lead to a failed
> print. It is therefore highly recommended to combine the high first
> layer height technique recommended above with this one. Setting the
> first layer height to 0.35 mm and the first extrusion width to 200 %
> would result in a nice fat extrusion 0.65 mm wide.

Tada! There we have the modifier from the screenshot; 200 % (this is expressed as a percentage over the layer height, and causes that an additional filament scale factor bigger than 1 is at play; the $x$ in your equations).

**To answer the second question**:

That should be rather straight forward, you know how long the path is and at which speed the head is moving (either at constant speed, decelerating or accelerating) and how much of filament you need to deposit, at the end point all filament needs to be deposited so you can calculate how fast the extrusion needs to be to accomplish that.

---

*If you calculate back from a volume of 8.214 mm2 and solve for unknown $w$ you see that this yields $ w = 0.65\ mm $, and that is exactly what is stated as first layer width in your Slic3r settings; I quote:*

> first\_layer\_extrusion\_width = 0.65

---

*P.S. When you look into the source code of [Slic3r](https://github.com/slic3r/Slic3r), if you dig deep, you find that extrusion width is bound by minimum and maximum values, it could well be that that is causing the value to differ from 0.70 mm (200 % of 0.35).*

> **Comments:**
> **username_3**: Excellent..! :-)  
> **username_4**: Very nice. I know it's a quote, but... "Setting the first layer height to 0.35 mm and the first extrusion width to 200 % would result in a nice fat extrusion 0.65 mm wide." - gets out calculator...  
> **username_2**: @username_4 Yep, my HP-48 G says 0.70, please don't shoot the messenger ;)  
> **username_0**: @username_2 Thank you for the explanation. The calculations match up when I use extrusion width = 0.65mm. I checked my slic3r config (edited my original question to add the picture). I am using a config from Prusa for 0.6 mm nozzle. Although its not set to auto, the value still corresponds to 200% (default). What was throwing me off was that the lines of g-code in my question correspond to external perimeter and there is a specific value for external perimeter width for external perimeters (0.61 mm). Does, the "first layer" width overrides the perimeter width too?  
> **username_2**: @username_0 Yes first layer overrides other settings.  
> **username_0**: @username_2 can you give me an example for the second part of the question that you answered above? Maybe use a trapezoid velocity profile for this?  
> **username_2**: @username_0 A trapezoid profile is not possible, it is constant, accelerating or decelerating, there are no other options. I'll update the answer with an example.  
> **username_0**: @username_2 doesn't the trapezoid velocity profile contain all the three segements (accelerating, constant and decelerating) you mentioned? . . . waiting for the answer for second part of the question  

---

