Set "Approx Total Print Time" by plugin

Hi,

I would like to enhance my Slicer Printtime Plugin to set also "Approx Total Print Time" as it seems not derived from estimated Printtime in the file upload. I debugged the code in GcodeAnalysisQueue and the updateGcodeEstimation and did not find any field to add it. Did anybody knows where I can overwrite it?

Also a question in general: why is the "Approx Total Print Time" not derived from the estimated printtime added on file upload? You can see that in the screenshot below.

Cheers,
Nils

Answered it myself perhaps: estimate_total is available in the estimator, but anyway why is the prepared estimation in the upload not used if available?

do you mean the estimate from the slicer? if so then there are plugins already that will do that.

For example Slicer Print Time Estimator or Prusa (M73 response) ETA Override

One of those is the plugin & author in question :slightly_smiling_face:

oops, missed that.

1 Like

Yes, nice to see that my plugin (slicer estimator) in known. :wink:

I ask to optimize my plugin and in general why Octoprint does not read the estimation stored in the uploaded file metadata on its own (or better if it should read it from there, but I did not find it in Octoprint code yet)

I suppose because not all slicers are the same, not all settings in slicers output the same, and therefore why add all that complexity to core when it should be able to be handled by plugin.

This is precisely the reason. I frankly don't have the time to constantly play catch up with all the slicers and slicer variants out there and what they change about the completely non standardized metadata they put into GCODE comments. I'd be happy to add a parser right into core if there was a general format that everyone could agree on and commit to use, however alas, there isn't. It's even worse than with GCODE interpretation and responses in firmware.

I like my plugin and do not like to optimise it away. :slight_smile: So let me do the integration.

I perhaps was not precise. I still parse the Gcode and write the estimation to the file metadata in OctoPrint format. But according the screenshot it seems not used by OctoPrint even if it is still there. Should it read it or should I change my code to overwrite estimation_total procedure?

I did some tests and it seems working fine. The problem comes up if I start printing directly from Cura. The Estimated Total Print Time is not available then and that runs into issues. If I print a file not directly the correct total time will be shown in my tests.

So perhaps somebody can give me a hint in which class I can check regarding the "Approx Total Print Time".

When you say...

Do you mean using the OctoPrint Connection plugin to send the file to OctoPrint and start printing right away? If that is the case then it probably is starting the print before the estimator/analysis starts and therefore isn't available to the system. I know @fieldOfView incorporates delays for PrintTimeGenius to complete it's analysis programmatically before giving the print command, maybe he could do the same for your plugin...

1 Like

When an application uses the API to upload a gcode file and it adds the option to start printing after the upload, then OctoPrint does not get/take the time to process files before the print is started. Like @jneilliii said, the current version of the Cura OctoPrint Connection plugin detects Print Time Genius specifically, and polls OctoPrint after an upload until the time estimates that PTG creates are available.

Perhaps I should contribute a PR for OctoPrint, adding an additional argument to the /api/files POST endpoint to delay the start of the print until processing by plugins is done. Until that time, I can see what I can do to support Slicer Print Time Estimator similar to how PTG is supported. What would be the best way to see that Slicer Print Time Estimator is done processing the file?

1 Like

@fieldOfView Actually I overwrite the standard analyser and implemented no interface to check something from the outside. So perhaps you can check if a file analysis is running on the uploaded file. This would be a good solution for the actual code and also a solution for every plugin in my opinion. :slight_smile: But as "Approx Total Print Time" is shown as "-" and not shows wrong values in general it seems not that important anymore. I thought before it will show something very different from me everytime.

@jneilliii @foosel Is there any way to overwrite "Approx Total Print Time" during print? Actually it shows "-" only after start printing with Cura. Perhaps the 40 minutes was not a real world case and created from my tests...so better ignore it or did you know why that could happen? As "-" is better than something very strange it is not that important anymore.

One general question: where and how (I can check this in the code on my own) is "Approx Total Print Time" filled with an value?

I like to understand what is behind that value and if it is filled from file-metadata only. Perhaps I misunderstood something and nobody has a todo.