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: Add Spoolman Compatability #4771

Draft
wants to merge 50 commits into
base: main
Choose a base branch
from

Conversation

Ocraftyone
Copy link
Contributor

@Ocraftyone Ocraftyone commented Mar 29, 2024

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:

  • Check if spool has enough material to finish print upon slicing
  • 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

-Spoolman utility class that fetches the spools, creates filament presets, and updates filament presets
-Add config entries for all needed values
make the config argument const. Allows more flexibility when calling it and in its current implementation, non-const access is not needed.
add force and detach options to create function

move call to get_filament_id past failure checks in the create function. It takes a few seconds to run and it is better to not run it if you don't have to

create get_name_from_spool function
Wouldn't load the filament if the "inherits" preset is not a base preset. The check is now done and it gets the base preset's parent if it needs to.
Added dialog itself

Added as it an item on the PlaterPresetCombobox

New extra renderer that renders a color in a dataview cell
# Conflicts:
#	src/libslic3r/Preset.cpp
#	src/slic3r/CMakeLists.txt
Merge in previous commit had a conflict that caused compile error.

Refactor code from merge to make it more readable

Add Refresh statement in the update to fix weird artifacting after selecting certain host types
Add Spoolman::is_server_valid()

Check validity of server in SpoolmanImportDialog and in Tab when clicking the update buttons

Hide the update buttons if Spoolman ID is 0

Check results from spool update when updating spools
@Ocraftyone
Copy link
Contributor Author

Ocraftyone commented Mar 29, 2024

@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.

Also minor fix regarding hiding scrollbars
@YanceyA
Copy link

YanceyA commented Mar 29, 2024

This is great! Big kudos for the work.

@Zimbo111
Copy link

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

@CooperGerman
Copy link

can't wait to see this integrated =)

@Ocraftyone
Copy link
Contributor Author

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 😊

…poolman-support

# Conflicts:
#	src/libslic3r/Preset.cpp
@besser
Copy link

besser commented Apr 20, 2024

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

@Jesibu
Copy link

Jesibu commented May 12, 2024

Can't wait to see this released :)

@StuSerious
Copy link

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!

@yw4z
Copy link
Contributor

yw4z commented Jun 25, 2024

@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

The struct is stored in a shared ptr. This is done so that if the statistics are updated on the edited preset, the changes will be reflected on the saved preset and vice versa
@Ocraftyone
Copy link
Contributor Author

Ocraftyone commented Jun 25, 2024

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

@yw4z
Copy link
Contributor

yw4z commented Jun 25, 2024

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
Copy link
Contributor

yw4z commented Jun 25, 2024

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

@Ocraftyone
Copy link
Contributor Author

  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.

@yw4z
Copy link
Contributor

yw4z commented Jun 25, 2024

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

@Ocraftyone
Copy link
Contributor Author

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.

@yw4z
Copy link
Contributor

yw4z commented Jun 25, 2024

let me know when you need it

@maxbec
Copy link

maxbec commented Jul 7, 2024

Is there any progress on this?

@kostecky
Copy link

kostecky commented Aug 8, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Spoolman intergration - Request Filaments IDs
10 participants