Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request] Add "print queue" functionality #301

Open
crispy1066 opened this issue Nov 3, 2013 · 37 comments

Comments

Projects
None yet
@crispy1066
Copy link

commented Nov 3, 2013

It would be nice if the user could create and manage a queue of files to be printed sequentially, one after another, with no manual intervention. This could be done separately from the file upload UI. The UI could be an additional tab in the top row (next to Temperature, Control, Timelapse, etc).

Naturally one would have to configure the machine (possibly by using custom end gcode) to automatically clear the completed print from the bed and reset for the next print.

I've attached a couple of quick hand sketches showing what I think the UI could look like and what the workflow would be like.
ui_1
ui_2

@foosel

This comment has been minimized.

Copy link
Owner

commented Nov 3, 2013

Marked as feature request.

Just for the record: Thank you so much for putting that much effort into this feature request 👍 :)

@crispy1066

This comment has been minimized.

Copy link
Author

commented Nov 5, 2013

Hi foosel,

Thank you for making octoprint awesome :D

@Auzze

This comment has been minimized.

Copy link

commented Nov 7, 2013

Been using octoprint for a few weeks now and it's GREAT.
I will put my hand up for "print queue" as it would be handy.

@foosel foosel modified the milestone: Possible Plugin Mar 23, 2015

@foulowl

This comment has been minimized.

Copy link

commented Jun 30, 2015

Another vote for this feature, and thanks for all your hard work!

@mdaniels5757

This comment has been minimized.

Copy link

commented Aug 7, 2015

I think this would be a very useful feature. +1

@markwal

This comment has been minimized.

Copy link
Collaborator

commented Aug 7, 2015

Totally doable in a plugin. Any of you up for giving it a go?

@mdaniels5757

This comment has been minimized.

Copy link

commented Aug 7, 2015

I'll give it a shot, but no promises.

@foosel

This comment has been minimized.

Copy link
Owner

commented Aug 7, 2015

Perfect, that's the spirit! 👍

Feel free to hit us up on IRC or the mailing list when you run into problems.

@mdaniels5757

This comment has been minimized.

Copy link

commented Aug 7, 2015

Sorry, this is way over my head. Anyone else able to do this?

@Salandora

This comment has been minimized.

Copy link
Collaborator

commented Aug 7, 2015

mdaniels5757 don't give up this fast, just ask question here or in IRC when I'm on, 'll help you as good as I can :-)

@mdaniels5757

This comment has been minimized.

Copy link

commented Aug 7, 2015

I'll try again. What would you suggest as an approach? I really have no idea.

@markwal

This comment has been minimized.

Copy link
Collaborator

commented Aug 8, 2015

A tutorial on how to make a hello world plugin is here: http://docs.octoprint.org/en/master/plugins/gettingstarted.html After that, two examples are probably helpful: PrintHistory because it makes a new tab and has its own business to do on it (https://github.com/imrahil/OctoPrint-PrintHistory) and then the builtin files sidebar (not that you want a sidebar, but because it uses the list helper and interacts with the storage system) which is in the OctoPrint sources. It's in files.jinja2, files.js and files.py (all in their respective folders).

@mdaniels5757

This comment has been minimized.

Copy link

commented Aug 8, 2015

Thanks! Any ideas for making the queue itself?

@markwal

This comment has been minimized.

Copy link
Collaborator

commented Aug 8, 2015

A few notions. Let's assume:

  • queue is relatively short (like less than 100 or so, seems likely to lose usefulness at a much lower number) so that we can just get and set the whole thing at once at each level
  • duplicates are allowed so that you can enqueue an object more than once
  • our first implementation can be in RAM on the pi so you lose it when you restart OctoPrint or the Pi, but not when you restart the browser (sd filesystem persistence can be phase 2)
  • we'll probably want to watch for filemanager events to update the queue when the user deletes one of the items from OctoPrint and while you can't rename things now, perhaps we'll want to be able to handle that in the future. But maybe this also can be in phase 2, but we should keep it in mind.

OK, so this suggests to me a simple array of filenames. Javascript array on the client, json over the network and a python list on the Pi.

The python list on the pi you put as a member variable of your plugin object (self.queue = [];) and then you implement a rest api that returns it and receives it as json: http://docs.octoprint.org/en/master/plugins/mixins.html#simpleapiplugin

Then in the browser in the javascript viewmodel you manipulate that array with a knockout binding to the HTML(jinja2) form and send it back and forth to the server via ajax.

For actually printing off of the queue, you'll want an event listener that waits for the job complete event and then delete the item off the queue and start the next print. Event handler: http://docs.octoprint.org/en/master/plugins/mixins.html#eventhandlerplugin, PrintDone: http://docs.octoprint.org/en/master/events/index.html#available-events, and starting the print would be self._printer.select_file(): http://docs.octoprint.org/en/master/modules/printer.html#octoprint.printer.PrinterInterface.select_file

@foosel

This comment has been minimized.

Copy link
Owner

commented Aug 8, 2015

Careful with the "starting the print" part. You want the user to clear the build plate first :) My approach here would be a little popup pushed to all (!) clients via self._plugin_manager.send_plugin_message and an onDataUpdaterPluginMessage callback in the view model on the client side like here to react to that. Have it say something like "Please clear the print bed, then click to continue", offer up a "Continue" and a "Cancel" button. Have it start printing the next file on "Continue" and not on "Cancel", like @markwal described above.

That should prevent accidents when printing multiple files after each other and not standing by on the end of each one ;)

@foulowl

This comment has been minimized.

Copy link

commented Aug 9, 2015

I think the goal is for the printer to push the part off the bed via some custom gcode, no human interaction needed. It's definitely a "use at your own risk" kind of thing!

What I would like to see for this plugin is the ability to track the amount of filament being used. When you change spools, you enter in the weight of the new spool, and the queue will stop printing if it calculates you'll run out of filament on the next print.

@foosel

This comment has been minimized.

Copy link
Owner

commented Aug 9, 2015

I'd suggest to concentrate on getting the basic functionality working first. Without trying to push stuff off (good luck getting that to work with very flat prints btw) or tracking filament usage or any other additional complex functionality.

Just a queue, some user interaction to fill that queue and step through it, that's it to get this working.

Otherwise you run the risk that you get lost in trying to install mood lighting inside the engine block of your car (to try to translate a metaphor that I was once taught). Divide and conquer :)

@starno

This comment has been minimized.

Copy link

commented Aug 9, 2015

I would love to see a printqueue plugin as well.

Instead of reproducing work that is already completed and open source, is it possible to implement the core of how Botqueue operates into a plugin?

Speaking from a casual user's perspective, Botqueue already has an excellent queuing manager that works with multiple machines not located on the same network, it's intuitive, provides usage statistics for objectively comparing machines performance against each other, links complete slicer settings with all jobs, and automatically stores images and even the temperature graphs of all jobs. It is designed for sending a queue to a farm, (>1) printers, so the obvious thing it lacks is the control panel type functionality that happens to be Octoprint's strength. I have been wanting to see the love child of these two for a long time now.

@markwal

This comment has been minimized.

Copy link
Collaborator

commented Aug 9, 2015

I'm with foosel, simple first and I think a botqueue plugin would make a great, completely separate plugin.

So, starno, how about it? Are you writing the botqueue plugin?

@foosel

This comment has been minimized.

Copy link
Owner

commented Aug 9, 2015

@starno I'm frequently talking with @Jnesselr from BotQueue and he said he's working on a rewrite of the API at the moment, so right now would probably not be the best time for adding BotQueue support to OctoPrint. Once the API is stable my guess is it would be perfectly possible through a plugin, and if not nothing stands in the way of making it possible through adding to OctoPrint.

I'm all against reinventing wheels, however I think that a simple local-install-only queue plugin and a full fledged BotQueue plugin can happily co-exist since they too serve slightly different purposes (e.g. in situations where you want a queue and don't have an internet uplink).

Also: I'd really just let @mdaniels5757 get a chance to tackle the basics (if he's not scared off by all those demands already - I hope not!) before piling on additional wishes. One step after the other really :)

@mdaniels5757

This comment has been minimized.

Copy link

commented Aug 9, 2015

So the flow would look like this?

Getting started now.

  • Add files 1 and 2 to file manager
  • Add files to queue
    • Added to JS array
    • Bonded w/ knockout to HTML form
    • Sent to server via REST API as JSON
    • Python array of filenames on pi
  • Queue starts file 1 Print
    • select_file(path, false, printAfterSelect=True)
  • File 2 remains in queue
  • File 1 is complete
  • File 1 removed from queue
  • Notification on client, clear bed and press continue to start print
  • Queue starts file 2 print and repeats
@Salandora

This comment has been minimized.

Copy link
Collaborator

commented Aug 13, 2015

Sounds great mdaniels5757.
I would be happy to beta test it when you have something to beta test :-)
Until then on any Problem just ask.

@mdaniels5757

This comment has been minimized.

Copy link

commented Aug 24, 2015

I'm unable to do this right now, someone else should probably take this over. Sorry!

@foulowl

This comment has been minimized.

Copy link

commented Aug 24, 2015

I'll give it a shot! It might take some time but I would love to try. Let me work through the hello world tutorial tonight.

@foulowl

This comment has been minimized.

Copy link

commented Aug 25, 2015

Alrighty, worked through the first hello world step. Running into my first issue.

Do I want to run:
pip install cookiecutter
on my dev machine or on the octoprint server itself? The hello world tutorial is unclear on that.

It works on my octoprint server, but fails on my dev machine with:
AttributeError: 'module' object has no attribute 'PROTOCOL_SSLv3'
Fixed by doing:
sudo easy_install --upgrade pip
sudo pip install requests==2.6.0
sudo pip install cookiecutter (wouldn't work without the sudo)

Thanks!

@foulowl

This comment has been minimized.

Copy link

commented Aug 25, 2015

I thought I had it figured out, I was going to guess I should be doing this all on my dev machine, but when I ran:
python setup.py develop
I get:
Could not import OctoPrint's setuptools, are you sure you are running that under the same python installation that OctoPrint is installed under?

So I'm guessing the expectation is to use the octoprint server as the dev machine too. Is that correct?

Thanks!!

@foosel

This comment has been minimized.

Copy link
Owner

commented Aug 25, 2015

You want to run that on your dev machine, wherever that may be. You can develop on a Pi if you want, personally I'd go for some local dev environment (with an ide and everything) however.

Might I also suggest to join the IRC channel or the mailing list for these kind of questions? Not really related to that ticket ;)

@foulowl

This comment has been minimized.

Copy link

commented Aug 25, 2015

IRC would be ideal. Let me hop on now!

@foulowl

This comment has been minimized.

Copy link

commented Aug 26, 2015

Alrighty, I have something going here: https://github.com/foulowl/OctoPrint-Printqueue

Check it out if you get a chance!

@mdaniels5757

This comment has been minimized.

Copy link

commented Aug 26, 2015

Just peeked at the code, it looks good so far. Do you plan on adding a popup for clearing the bed? And how do you add files to the queue?

@foulowl

This comment has been minimized.

Copy link

commented Aug 26, 2015

Thanks! :) Making a bit of progress on the API today.

I would like to add that "clear bed" popup as an option, because my use case requires no popup. (In fact, having the popup for me defeats the purpose of the queue entirely!) so it's on the list.

From talking with @markwal it sounds like the best way would be to just have a second "select" with the list of files. I originally wanted to inject an additional button in the current file list to try and stick with the DRY principle, but sounds like it's not really feasible without modifications to OctoPrint itself.

@chasecromwell

This comment has been minimized.

Copy link

commented Jan 24, 2016

Any progress been made @foulowl @mdaniels5757 ?

@foulowl

This comment has been minimized.

Copy link

commented Jan 26, 2016

No progress for awhile sadly. Let me see if I can pick this back up again. This is a feature I really need personally.

@foosel foosel added the plugin idea label Mar 10, 2016

@PowerShellCrack

This comment has been minimized.

Copy link

commented May 24, 2017

So is this still in development? I think this is a great idea but with a slight modification that might make it easier. Instead of queuing up multiple prints and expecting the bed to be clear before the next one starts, why not just present a popup window when a print is complete asking if the user would like to print another file (list whats in the file manager) , if not close the page.

The benefit I see with something as simple as this is I find myself printing 20-30 things with the same ABS filament, but having to wait for the bed to reheat which is taking up valuable time. I found that if I remove the:
M104 S0 ;extruder heater off
M140 S0 ;heated bed heater off (if you have it)
from Cura or any slicer, I do not have this issue anymore, but now If I want to print while I'm sleeping and it ends like at 3 in the morning the extruder and heat bed are on all night until I get up and check it. I really don't like the bed and extruder on all night. A cool feature would be if the print completes a popup message would appear and if the user is not there after 10 minutes (configurable), turn off the heat elements and reset X and Y positions to zero (configurable)...or even turn off printer. If the user does click print another, the user can either select from the file manager or upload a new gcode file. When they select the file and click OK maybe have a additional prompt asking if the bed is clear to proceed. If so it will proceed with printing; if not, it will give the user an additional countdown(configurable)... if no response, stop prints.

Some of the configurable items could be:

  • Queue Next Item Message Timeout
  • Queue Next Item Message Timeout action (GCODE)
  • Preparing Next Item Message Timeout
  • Preparing Next Item Message Timeout action (GCODE)

I wish I knew how to write this. I have reviewed the hello world code and this one and have not been able to figure it out.

@PowerShellCrack

This comment has been minimized.

Copy link

commented May 24, 2017

I read that is it possible to do this using the conf.xaml file with events?https://github.com/foosel/OctoPrint/wiki/Available-Events

@proffalken

This comment has been minimized.

Copy link

commented Jan 30, 2018

Hey all, also interested in this.

At the moment I've got my 3D printer connected to a LightwaveRF socket which is controlled by HomeAssistant.

HomeAssistant also monitors my Octoprint installation and shows me the current status.

What I'd like to achieve with this kind of plugin is to be able to send a print to Octoprint and have the fact that there is a job waiting in the queue trigger HomeAssistant to turn on the printer. OctoPrint would then connect to the printer and start printing, and once the job had reached 100%, HomeAssistant would turn the printer off again.

Is this possible with the existing code, or does it need further development?

@foosel

This comment has been minimized.

Copy link
Owner

commented Feb 5, 2018

It would be possible through a plugin.

@foosel foosel removed this from the Plugins milestone Jun 20, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.