1
$\begingroup$

I am curious about the algorithm/principles behind the estimates that the slicing softwares provide. Is there a standard technique behind this and how accurate is it ?

$\endgroup$
1
  • $\begingroup$ And let's not forget the psychological part: the beginning of a print always seems to take forever, partly because there's little in the way of recognizable shapes. The last 25% or so of the layers , not only is the shape quite visible, but typically these layers cover much less area than the base, so the time per layer does decrease. $\endgroup$ – Carl Witthoft Aug 9 '17 at 12:58
1
$\begingroup$

Generally speaking, the typical algorithm takes into account the slicer's speed settings for specific features of the build, such as infill, perimeters, top/bottom layers, etc. The distance traveled by the nozzle at a specific speed for each feature is also part of the equations involved. There are some rather vague portions of the nozzle movement based on acceleration and other factors which makes the calculations less accurate.

How accurate is it?

Not too accurate. My experience with three different slicers is that it's never been within better than ten percent. I believe the various combinations of features of a build are not going to be identical from one model to the next, preventing even a ballpark figure to be created from previous builds.

$\endgroup$
3
  • $\begingroup$ Can you provide a reference where one could see how these calculations are made ? Like a piece of code or the algorithm itself. $\endgroup$ – GSH Aug 9 '17 at 1:14
  • $\begingroup$ Tom van der Zanden's answer is a bit more convoluted than I can follow, not being a code person, but is a good start. I've found a number of web sites containing basic descriptions of calculations, including forums.reprap.org/read.php?2,647001 but all of them appear to be missing various factors. In most of the sites, the acceleration is ignored or approximated. As a result, the build times are approximations. I suppose if one were applying orbital dynamics mathematics to 3D printing, one could get more accurate results. $\endgroup$ – fred_dot_u Aug 9 '17 at 11:01
  • $\begingroup$ Unless you're dealing with multi-day prints, I'd say 10% is more than adequate accuracy. $\endgroup$ – Carl Witthoft Aug 9 '17 at 12:54
4
$\begingroup$

Much of the software used in 3D printing is open-source, and so are some slicers. Cura, for instance, does (or did, this source code is from an older branch) its print time estimation in gcodeInterpreter.py.

The relevant portion of the source code is (simplified and with many lines removed for clarity):

    totalMoveTimeMinute = 0.0
    pos = util3d.Vector3()

    for line in gcodeFile:
        G = self.getCodeInt(line, 'G')
        if G is not None:
            if G == 0 or G == 1:    #Move
                x = self.getCodeFloat(line, 'X')
                y = self.getCodeFloat(line, 'Y')
                z = self.getCodeFloat(line, 'Z')
                e = self.getCodeFloat(line, 'E')
                f = self.getCodeFloat(line, 'F')
                oldPos = pos.copy()
                pos.x = x
                pos.y = y
                pos.z = z
                feedrate = f
                currentE = e

                totalMoveTimeMinute += (oldPos - pos).vsize() / feedRate

As you can see, (this version of) Cura simply:

  • Loops over all the G-code instructions,

  • Computes the length of each move (in X/Y/Z) and divides that by the feedrate to get the time that move will take,

  • Sums this up over all the moves.

and does not take into account:

  • Acceleration or deceleration. It assumes the printer is always operating at the maximum feedrate,

  • The length of filament extruded. The feedrate is the speed for the move in (X,Y,Z,E), but Cura only looks at (X,Y,Z).

  • The time it takes to heat up the print bed/hotend or homing/autoleveling,

  • The effects of the printer slowing down if moves can not be read (from USB/SD-card) sufficiently fast (though this would be rather hard to include in any estimate).

The accuracy of this estimate can be arbitrarily bad if the feedrate is set to some unrealistic value.

Newer versions of Cura use a much more advanced time estimate method, and it can be found in timeEstimate.cpp. It is much more complicated, and actually takes jerk/acceleration/deceleration into account. It is much more accurate.

We know exactly how 3D (open source) 3D printer firmwares work, so estimating print time is as easy as simulating execution of the G-code by your given firmware. There is no reason you can't get a really good estimation (if you take into account all of the intricacies of your given firmware's acceleration/deceleration techniques) but writing the code for it is rather involved.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.