cryptiklemur / node-bambu

MIT License
19 stars 1 forks source link

[Feature Request] Additional Print Stats from 3MF/FTPS #2

Open WolfwithSword opened 1 year ago

WolfwithSword commented 1 year ago

Since I saw you have the setup for FTPS, a nice feature may be to include a status message for advanced print stats, such as an embedded image of the generated print preview, amount of material length or in grams, material types / trays, or any other misc print setting.

All of these are stored in the 3mf file that gets sent to the printer which you can FTPS back to parse. In all cases except if it were printed from the "print again" button on the printer, the "subtask" name from the mqtt json will be part of the filename. It may or may not end in .3mf, or .gcode.3mf, or have no suffix in the "subtask" string so I'd suggest looking for all combinations of the root filename both in the root path of the printer "/" and in "/cache", where "/cache" if enabled will be where prints from bambu studio end up if "print plate" is selected.

The 3MF file is just a glorified zip file. Each "plate"'s gcode will be in there. You can determine which plate you are printing by getting the "gcode_file" string from the mqtt json - it's even how the slicer gets the plate info and is always consistently named.

Inside the 3MF, the Metadata folder will have everything useful, from png images for each plate, slice_info.config, model_settings.config and project_settings.config are XML files which should give you pretty much anything you'd ever like.

I could see an additional print stats message showing the amount of filament in grams and length for the print, the amount used as supports vs not, the number of filaments used in the print, the plate number info (since all of these other things are per-plate needing to be parsed), the generated image etc.

cryptiklemur commented 1 year ago

Partially added in https://github.com/aequasi/node-bambu/releases/tag/0.2.0