How is the E argument calculated for a given G1 command?

4

1

I'm working on building a tool to generate G-code (a simpler slicer), and I'm trying to calculate how much filament should be extruded per movement.

Is there a standard calculation for this? Something like:

layer height * flow % * extruder diameter * distance 

How does Ultimaker Cura calculate this?

t. gl.

Posted 2018-07-05T17:35:22.243

Reputation: 41

Answers

6

Basically, all movements are (small) straight lines, the volume of a straight line is easily calculated as you already guessed.

To calculate the volume to be extruded you multiply the following parameters:

  • the layer height (h)
  • flow modifier (e.g. as pertectage) (SF)
  • extruder nozzle diameter (d)
  • distance of the straight line (l)

With this volume you can calculate how much filament you need to extrude. To get the length (thus the length defined by the E parameter), divide the obtained volume by surface area of your used filament by:

  • π * (filament radius)2 or alternatively π /4 * (filament diameter)2

To sum up, the value of E is given by:

enter image description here

0scar

Posted 2018-07-05T17:35:22.243

Reputation: 25 570

Thanks! Just to clarify:

extrusionVolume = (layer height * flow modifier * nozzle diameter * straight line distance)

E argument = extrusionVolume/π * r2, where r is the radius of the filament?

What was the formula you listed after π * r2 (it doesn't look like it's equivalent)?

Is it safe to assume that for G2/G3 (arcs), it's the same, but with the perimeter of the arc instead of the distance of the straight line? – t. gl. – 2018-07-05T18:39:46.160

@t.gl. Diameter is twice the radius so to get radius squared is similar as diameter squared divided by 4. To calculate arcs (for G2/G3), you need to know the radius of the arc and the section (or angle). Arc circumference is 2 * π * arc radius * percentage of the circle. – 0scar – 2018-07-05T18:58:31.133