OrcaSlicer icon indicating copy to clipboard operation
OrcaSlicer copied to clipboard

Feature: Add Spoolman Compatability

Open Ocraftyone opened this issue 1 year ago • 45 comments

Add Spoolman support to OrcaSlicer!

Spoolman is a self-hosted database of your spools of filament and how much has been used. This update now allows OrcaSlicer to directly access your Spoolman database to create and update filament profiles. One central database of all of your spool settings means less time inputting filament parameters.

Currently, this implementation is designed to only work with Klipper printers that have moonraker also set up with Spoolman. A macro can then be called at the beginning of each spool's custom gcode to load the spool via moonraker. Moonraker will then track how much filament was used and report that back to Spoolman.

Demo: spoolman demo

Filament config values that are set

Spoolman Specific:

  • spoolman_spool_id
  • spoolman_remaining_weight
  • spoolman_used_weight
  • spoolman_remaining_length
  • spoolman_used_length
  • spoolman_archived

Filament Options:

  • filament_type
  • filament_vendor
  • filament_cost
  • filament_density
  • filament_diameter
  • nozzle_temperature_initial_layer (set by adding 5 degrees to normal temp)
  • nozzle_temperature
  • hot_plate_temp_initial_layer (set by adding 5 degrees to normal temp)
  • hot_plate_temp
  • default_filament_colour

Other ideas to expand functionality:

  • [x] Check if spool has enough material to finish print upon slicing
  • [x] Add option to "consume" filament upon upload
  • [ ] Store the entire filament configuration in Spoolman (via the Spoolman API's "extras" section)

Possible Changes: ~~Statistics are currently a config value that is updated upon request, but I am considering making it so they are just pulled when you select a Spoolman spool~~ This has been implemented.

Moonraker Docs on how to setup Spoolman integration: https://moonraker.readthedocs.io/en/latest/configuration/#spoolman Spoolman Project: https://github.com/Donkie/Spoolman

fixes #2955

Ocraftyone avatar Mar 29 '24 18:03 Ocraftyone

@Noisyfox I did a refactor of a few lines of PhysicalPrinterDialog in 4ec7c12 that makes it a bit more readable with my changes. I don't believe I broke any of the functionality of your SimplyPrint integration, but if you could take a look at it and confirm, it would be much appreciated.

Ocraftyone avatar Mar 29 '24 18:03 Ocraftyone

This is great! Big kudos for the work.

YanceyA avatar Mar 29 '24 21:03 YanceyA

If Spoolman could be integrated like this, it would be great. Many thanks for the work . I hope it will be implemented

Zimbo111 avatar Mar 30 '24 08:03 Zimbo111

can't wait to see this integrated =)

CooperGerman avatar Apr 15 '24 09:04 CooperGerman

I was taking a bit of a break from this to work on the CMake system overhaul PR. Moving back to this to hopefully get it finished up 😊

Ocraftyone avatar Apr 17 '24 13:04 Ocraftyone

@Ocraftyone this integration you did was awesome!!! Can't wait to see this integrated too :)

besser avatar Apr 20 '24 21:04 besser

Can't wait to see this released :)

Jesibu avatar May 12 '24 07:05 Jesibu

Spoolman is now able to pull from a global database of filaments, materials and manufacturers (see https://github.com/Donkie/SpoolmanDB), should you be interested in implementing it as a feature (say to search for your new spool directly in the slicer) I'd be willing to help test/develop!

StuSerious avatar May 28 '24 11:05 StuSerious

Spoolman is now able to pull from a global database of filaments, materials and manufacturers (see Donkie/SpoolmanDB), should you be interested in implementing it as a feature (say to search for your new spool directly in the slicer) I'd be willing to help test/develop!

Sorry for the late response. That is a super cool feature and could definitely be implemented in the future, but I think it would be out of scope for this PR.

Ocraftyone avatar Jun 06 '24 12:06 Ocraftyone

Hello! Thanks for the interest in this PR! I wanted to give an update on what has been done since the initial release of this PR.

The slicer will now send a warning if you slice a model and one of the filaments does not have enough material.

The way the statistics for the spool are are saved has been updated. The stats are no longer saved to the preset's config. This removes the unnecessary action of saving the data to the preset's json file since the data should be fetched upon startup to ensure that it is up to date.

Speaking of keeping the spools up to date, the statistics of all active spools are now (re)loaded on startup and upon switching printer profiles.

That is it for the currently implemented updates! Right now, I am working on implementing I am working on consuming the filament.

I do still have one other thing to address. I am not very happy with how the notification is displayed for not enough filament is displayed. It tends to hide behind the gcode preview. I have contemplated trying to adjust the notification to stay on top of the gcode preview, but from my testing, it could get janky since there is no way to explicitly give priority to the notification for the overlap (at least that I found). I also need to determine how in the UI to allow the user to indicate they want to consume the estimated filament used upon export. I am thinking just a checkbox during the upload dialog, but I am open to ideas. @yw4z , @SoftFever , or anyone else with feedback, I would be greatly appreciate your input.

Ocraftyone avatar Jun 24 '24 22:06 Ocraftyone

@Ocraftyone I dont use this software but it looks great and useful. here is my ideas for usage • Tab / Page for full spoolman control like device tab • you can create an icon on filament title bar for easy access. Icon will be only visible if option enabled • spoolman icon can show remaining percantage of filament. i guess this one is main purpose of spoolman • Hovering on icon give detailed information on tooltip for selected filament • We can use colors on icon to indicate its on low. Icon color will use red if <%10 and yellow for <%25 • maybe this icon would work as dropdown menu if you planing to add more features. Import / Update usage / Add to spoolman / Spool usage(disabled element) • maybe moving enabling spoolman support to main preferences window would be better because its not spesific to machine. but ignore this if running multiple spoolman instances a thing • Use a popup notification / warning if filament will end while printing and it detected while slicing process. i guess it would be nice because its a critical thing i can design icons for it if you positive about these ideas

yw4z avatar Jun 25 '24 04:06 yw4z

maybe moving enabling spoolman support to main preferences window would be better because its not spesific to machine. but ignore this if running multiple spoolman instances a thing

I implemented the setting into the printer profile because I figured it would allow for more flexibility, but I also very much understand the idea of having it as an application specific setting rather than printer. Honestly, that would cut down on the possible issue of having two different spools from two different Spoolman instances with the same ID.

Tab / Page for full spoolman control like device tab

I also do like the idea of having a sort of Spoolman dashboard where you add the filament presets to Orca and even pull/create spools based on SpoolmanDB like suggested above, but I would really like to get a fully functional implementation before expanding to ideas like that. I would love to have icons designed when/if I implement that. I really hate graphic design XD

What I was really looking for guidance on was how to display the filament run out warning. The current way the notification is being displayed is way too subtle, but I also feel fully interrupting the user with a dialog could be cumbersome and annoying at times. @yw4z

Ocraftyone avatar Jun 25 '24 08:06 Ocraftyone

ALERTS / NOTIFICATIONS

I guess better to use system dialog for warning if spool has less material then sliced print but you can create 2 types notifications for that.

one for less critical • there is a huge difference between spool and sliced print. user already know sliced print will take 2-3 spools • probably user will check "dont show again" check box for this • Use regular icon for this dialog • Show this as notification if user selected "dont show again"

one for more critical • sliced print is very close to spool weight. user basically will reduce some infill settings to fix that • Use warning icon for this dialog • Show this as notification if user selected "dont show again"

ICON USAGE

Screenshot-20240625120258

Here is a generic (used if there is no spoolman information) and level icons Screenshot-20240625114712

• You can add icon to left side for settings icon. near of AMS button. both has similar functions if you generalize as filament management

DROPDOWN MENU

menu usage if filament doesnt have spoolman information. generic icon used Screenshot-202406251202dasda58

menu usage if filament have spoolman information. spool level used as icon Screenshot-202406251202518

icon will make easy to access for spoolman feature. here is my suggestions for menu elements with menu order • ~257 / 1000 gr

disabled element that shots spool usage tilde symbol indicate its estimated It will be hidden if no spoolman info

• Add this filament

Quick access for importing current filament It will be visible if no spoolman info

• Set usage

Opens a popup with input box near cursor. so user can add / subtract additional usage easily for current filament without dealing manage window

• Import

Will open import window. using this in menu will be better if user has long list of filaments

yw4z avatar Jun 25 '24 09:06 yw4z

and alternative icon sets with using bars for level. its easier to understand but looks a bit old Screenshot-20240625124503

yw4z avatar Jun 25 '24 09:06 yw4z

  1. Damn you work fast!
  2. Notifications: So you are suggesting using a popup dialog rather than a notification/a warning drawn on the screen?
  3. Icons: Love them. Honestly, I think adding them all and making it a user preference would be awesome.
  4. Dropdown menu: I don't think this would work all that well. First, if there are multiple spoolman enabled filaments, there wouldn't be a very easy way to display each one and indicate which is which. Second, I am not thinking of adding the ability to manually set the usage. My idea is that manually setting should not have to be done. I will have an option to consume the material needed for a print and maybe an undo button if the action is performed by mistake. Adjusting values not related to a current print should still be done via the Spoolman web interface. The one thing I do agree with is moving the import button out of filament dropdown.

Ocraftyone avatar Jun 25 '24 10:06 Ocraftyone

2- yes i'm suggesting using popup dialogs with "dont show again" option. at least for critical level. 3- i will commit them all if you ok with all options 4 - i guess percentage for icons also has possible problem if multiple spoolmans not in sync for same filament. maybe clicking icon will open spoolman tab directly. Showing detailed spoolman info on tooltip still a good option

yw4z avatar Jun 25 '24 11:06 yw4z

I wouldn't commit the icons quite yet. At the current pace of this pr, its going to be a bit before getting to setting up those changes. Honestly, they will probably be another pr.

Ocraftyone avatar Jun 25 '24 11:06 Ocraftyone

let me know when you need it

yw4z avatar Jun 25 '24 12:06 yw4z

Is there any progress on this?

maxbec avatar Jul 07 '24 12:07 maxbec

This is amazing work, thank you! Is there a Orca release this is slated for?

kostecky avatar Aug 08 '24 12:08 kostecky

This is some fantastic work! I look forward to seeing where this goes. Is there anything I can do to help?

weemantella avatar Oct 01 '24 04:10 weemantella

Same question as @kostecky 👍

johnbxl1970 avatar Oct 08 '24 09:10 johnbxl1970

@weemantella @johnbxl1970 Not quite yet, but I will let you know. I have gotten back around to putting more time into this so I can put the final touches on it. I will let you all know when I get to the point I need testing 😁

Ocraftyone avatar Oct 29 '24 00:10 Ocraftyone

Currently I am working on the notifications for low material warnings. I was able to find a notification level that fixes the issues I noted above. I also discovered that there is a warning dialog that is shown when you attempt to export when you got a slicing warning. I have overhauled that so that it is much more functional and will work in place of a dedicated spoolman warning dialog. Next step after this will be implementing a dialog after export that asks if you want to consume the filament. I will also show a notification saying if the consume was successful and allow the consume to be undone. After these changes are made, it should be ready to test and will only need refinement, such as moving spoolman to a global setting rather than being tied to a specific printer and an import error I have noticed. Thank you everyone for your support!

Ocraftyone avatar Oct 29 '24 00:10 Ocraftyone

Hi @Ocraftyone

Super excited to see this happen!

A point to discuss from my recent experience with Spoolman and happy hare.

With the expansion of multi material units in Klipper and the rapid development in Happy Hare, it would be good to discuss how these two systems can interact with each other to offer a more user friendly way to manage filaments in an MMU setting.

Let me explain what I mean:

  1. Happy Hare has the ability to read the MMU Gate to Filament ID mapping from Spoolman, with the spoolman database being considered as the source of truth. This is then stored in the happy hare local gate to tool map
  2. Alternatively Happy Hare can publish to Spoolman what spool is used on what gate based on its internally maintained Gate to Tool Mapping: i.e. The local gate map is considered as the source of truth and will be pushed to spoolman

For option (1) - where spoolman is the master of the filament to gate - tool mapping, the user either updates the gate/filament mapping using the spoolman UI and then that gets pulled into Happy Hare. Alternatively this command can be used from the printer console: MMU_SPOOLMAN GATE=3 SPOOLID=74 which updates the spoolman gate to spool mapping and then refreshes Happy Hare with the information from Spoolman (for all spools assigned to gates, included the updated one)

For option (2) - where Happy Hare is the master of the filament to gate to tool mapping, the spoolman ID to gate ID map can be updated from HH to Spoolman with this Gcode command at the printer console: MMU_GATE_MAP GATE=3 SPOOLID=74

References: https://github.com/moggieuk/Happy-Hare/wiki/Spoolman-Support

What I am thinking here is how do we bring the slicer together with the above to make multilateral management and filament consumption more "seamless".

One way could be:

  1. The user has the ability to select the gate where a filament is mapped to in the Orca slicer UI - i.e. a text box in the spoolman tab of the filament where the custom field MMU Gate is displayed (if that field is available). That field could have the option to be auto populated with the tool number the filament is currently allocated at (i.e. tool minus 1 as its 0 based). That option can be placed in the printer settings (i.e. auto update gate number to match tool number).
  2. The gate to filament mapping then is pushed to spoolman updating two custom fields (printer name and gate ID (0 based)). image The printer name can be sourced from a new text field here (as the printer name in the profile can be different to the printer name in Klipper, especially if people have multiple printer profiles for one physical machine, eg. for different nozzle sizes) image

That way the gate to filament mapping can be updated directly from the slicer and, optionally, auto updated based on the filaments that are selected by the user in the filaments selection.

If we want to take it further a dialogue similar to what Bambu does can be implemented that updates both the Happy Hare tool to gate map and the spoolman gate to filament map.

This becomes even more exciting with solutions like this https://github.com/moggieuk/Happy-Hare/wiki/Spoolman-Support#---auto-setting-with-rfidqr-code-reader, where an NFC reader can be used to automatically update spoolman bringing klipper MMU management on par with Bambu's automated filament material management!! :O

I appreciate this may be roadmap stuff right now but bringing in those two custom fields would be a fantastic first step, to consolidate filament management in a single application - the slicer :)

igiannakas avatar Nov 20 '24 14:11 igiannakas

Thxs for your work, looking forward to this,

ducati1198 avatar Nov 27 '24 04:11 ducati1198

I'm so excited to see when spoolman is fully integrated. I'm already looking forward to it

Zimbo111 avatar Nov 27 '24 04:11 Zimbo111

I'm so excited to see when spoolman is fully integrated. I'm already looking forward to it

Zimbo111 avatar Nov 27 '24 05:11 Zimbo111

This is a really cool feature! Do we have any updates on it? is there a way we can have this as an alpha/beta to test?

meltiseugen avatar Dec 20 '24 14:12 meltiseugen

This feels so right! What an amazing job, I hope to see it on OrcaSlicer soon!