How to calculate Approximate Time of a 3D Printed object? March 31, 2016 08:43PM Registered: 9 years ago Posts: 4
Hi friends,
I'm a Developer and I was looking for an algorithm which calculate approximate time of an 3d object, something like Cura Software when you load a STL File. Actually, I already checked Cura's code on Github, but I didn't find anything.

Does anyone know how to calculate the time?

Thank you, I'll appreciate it.

Edited 1 time(s). Last edit at 03/31/2016 08:44PM by rokumetal.
 Re: How to calculate Approximate Time of a 3D Printed object? March 31, 2016 09:04PM Registered: 8 years ago Posts: 91
It varies wildly according to slicing settings, so it can only be done accurately after you have gcode ready.

Other than that you could probably use a linear approach multiplying several parameters by constant gains and adding them up, e.g.:

K0*1 +
K1*height +
K2*surface area +
K3*volume +
K4*XY plane protection area +
...

Figuring out the K gains via least-squares fitting of several sampled objects.
 Re: How to calculate Approximate Time of a 3D Printed object? March 31, 2016 09:19PM Registered: 9 years ago Posts: 4
Thanks for your response, I think I should do it like you propose, but is my last option, meanwhile I'll check Cura's code again.
 Re: How to calculate Approximate Time of a 3D Printed object? April 05, 2016 01:20AM Registered: 9 years ago Posts: 4
Thank you so much! I'm gonna work with this formula.
 Re: How to calculate Approximate Time of a 3D Printed object? April 05, 2016 01:29AM Registered: 11 years ago Posts: 580
An accurate way is to read through the gcode and add up the individual segment times.

Your program would need to parse the individual lines, extracting the X and Y position, Feed rate, and extrusion amount (for retract and unretract - see below).

So you might have two lines like this:
G1 X0.00 Y0.00 F1200
G1 X10.00 Y0.00 E1.01

Not every line must have a feed rate, so store it when it changes. The Feedrate F1200 is mm/min, so divide by 60 for mm/sec.

Feedrate in mm/sec:
20 = 1200/60.

The distance is calculated using the last X and Y pos, and the current X and Y pos.
distance = abs(sqrt((lastX - newX)^2 + (lastY - newY)^2))
10 = abs(sqrt((0 - 10)^2 + (0 - 0)^2))

Then store your current X and Y position to lastX and lastY.

SegmentTime = distance / feedrate
0.5 = 10 / 20

You can ignore the E parameter (that's the amount extruded) - except when you want to calculate the time for retracts or unretracts - these have no change in the X or Y position (or no X or Y position on the line at all). The feedrate would be specified on these lines. It is simpler to calculate if you had set your slicer to use relative extrusion.

Then parse your next line of gcode...

This calculation will get you close.
Then test it against an actual print.

Edit: Corrected typo in segment time result.

Edited 1 time(s). Last edit at 04/05/2016 08:58PM by Paul Wanamaker.

My printer: Raptosaur - Large Format Delta - [www.paulwanamaker.wordpress.com]
Can you answer questions about Calibration, Printing issues, Mechanics? Write it up and improve the Wiki!
 Re: How to calculate Approximate Time of a 3D Printed object? April 05, 2016 02:46PM Registered: 11 years ago Posts: 198
If you want to estimate print time, before g-code generation, the relationship between total surface area and the volume of the part, might be worth taking into the formula also, as this would give an indication of the level og surface details, and holes in the part, i.e. a small part with a large surface (in relation to it's size), will have a lot of perimeters to print.
Sorry, only registered users may post in this forum.