I want to programatically generate G-code for a (Marlin-based) Ultimaker 2+ printer, and I have been looking at the Marlin documentation and working G-code examples generated by Cura.

This has left me confused about exactly how Marlin interprets the feedrate (F) parameter in G-code commands.

If I move on a single axis (e.g. G1 F7000 X10 or G1 F200 E50), then I assume F simply says how fast that axis should move (ignoring acceleration).

On CNC milling machines I've worked with, the same is true when moving on multiple axes – for instance, G1 F1000 X10 Y10 Z10 would mean the tool moves at 1000mm/min, and therefore the individual axes are each moving at 693mm/min. Which is good, because it means the feedrate doesn't depend on the direction of movement.

But a 3D printer has four axes (E, X, Y, Z), and Marlin only uses a single feedrate parameter. So do I need to calculate that in four-dimensional space? In other words,

$F = \sqrt[4]{F_E^4 + F_X^4 + F_Y^4 + F_Z^4} ?$

If that is not correct, how is the feedrate related to the feedrates for the individual axes?.


1 Answer 1


Feedrates are not 4-dimensional, and yes this makes them a bit inconsistent. But physically the 4-dimensional speed would not make any sense - for example, slowing down the E axis while speeding up the X axis would not maintain the same "overall speed" in any meaningful sense.

So, feedrates work differently for:

  • Moves with a nonzero X, Y, or Z component: the feedrate is an ideal, desired speed in 3 dimensions, possibly limited by the max feedrates of each axis (including E) individually, as well as their acceleration profiles.

  • Extruder-only moves where X, Y, and Z components are all zero: the feedrate is an ideal, desired speed in one dimension: the E axis, and may be limited by the max feedrate and acceleration profile for the E axis.

  • $\begingroup$ Aha! I did wonder if that was the explanation for how Cura's "print speed" can be the same as the feedrate it uses for printing moves. I guess it keeps things simple. The 4D approach wouldn't be completely insane, but it would mean you'd have to continually adjust F to get a constant movement speed or constant extrusion rate. (FWIW, specifying the end position and time fully determines the solution, so you couldn't actually slow down E while speeding up X) $\endgroup$
    – bobtato
    Oct 26, 2020 at 21:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .