Welcome! Log In Create A New Profile

Advanced

How to calculate Approximate Time of a 3D Printed object?

Posted by rokumetal 
How to calculate Approximate Time of a 3D Printed object?
March 31, 2016 08:43PM
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. smiling smiley

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
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
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. smiling smiley
Re: How to calculate Approximate Time of a 3D Printed object?
April 05, 2016 01:20AM
Thank you so much! I'm gonna work with this formula. smiling smiley
Re: How to calculate Approximate Time of a 3D Printed object?
April 05, 2016 01:29AM
An accurate way is to read through the gcode and add up the individual segment times.
Your program would focus on the segments that start with G0 or G1.

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.

Then calculate the segment time, add that to your total seconds.
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.
To start with, add about 5% for acceleration, plus warmup time if any.
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
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.

Click here to login