Open astrobokonon opened 4 years ago
The container might be kinda fun since it's a binary file, and I'm wondering if the thumbnail is embedded in there as well. Since Cura started life in the community I think the library that parses the .ufp file could just be brought in here as a dependency?
Yup, it's in the Cura tree: https://github.com/Ultimaker/Cura/tree/master/plugins/UFPReader
Weridly, the ufp file returned by the API is 2x the size of the one I grabbed directly off of the printer via scp? And the one from the API doesn't open as an archive like I expect, but the one from the printer directly does? I don't know what the hell is going on with the API apparently.
In the gcode, regardless of how I get it, there's the following juicy bits of info:
;START_OF_HEADER
;HEADER_VERSION:0.1
;FLAVOR:Griffin
;GENERATOR.NAME:Cura_SteamEngine
;GENERATOR.VERSION:4.4.1
;GENERATOR.BUILD_DATE:2019-12-23
;TARGET_MACHINE.NAME:Ultimaker 3 Extended
;EXTRUDER_TRAIN.0.INITIAL_TEMPERATURE:245
;EXTRUDER_TRAIN.0.MATERIAL.VOLUME_USED:197011
;EXTRUDER_TRAIN.0.MATERIAL.GUID:2f9d2279-9b0e-4765-bf9b-d1e1e13f3c49
;EXTRUDER_TRAIN.0.NOZZLE.DIAMETER:0.4
;EXTRUDER_TRAIN.0.NOZZLE.NAME:AA 0.4
;BUILD_PLATE.TYPE:glass
;BUILD_PLATE.INITIAL_TEMPERATURE:80
;PRINT.TIME:66521
;PRINT.GROUPS:1
;PRINT.SIZE.MIN.X:9
;PRINT.SIZE.MIN.Y:6
;PRINT.SIZE.MIN.Z:0.27
;PRINT.SIZE.MAX.X:183.716
;PRINT.SIZE.MAX.Y:177.242
;PRINT.SIZE.MAX.Z:112.87
;END_OF_HEADER
;Generated with Cura_SteamEngine 4.4.1
...
;LAYER_COUNT:564
...
;End of Gcode
;SETTING_3 {"extruder_quality": ["[general]\\nversion = 4\\nname = Fast #2\\ndef
;SETTING_3 inition = ultimaker3_extended\\n\\n[metadata]\\nquality_type = draft\
;SETTING_3 \nposition = 0\\ntype = quality_changes\\n\\n[values]\\ninfill_patter
;SETTING_3 n = grid\\nwall_thickness = 2\\n\\n", "[general]\\nversion = 4\\nname
;SETTING_3 = Fast #2\\ndefinition = ultimaker3\\n\\n[metadata]\\nquality_type =
;SETTING_3 draft\\nposition = 1\\ntype = quality_changes\\n\\n[values]\\n\\n"],
;SETTING_3 "global_quality": "[general]\\nversion = 4\\nname = Fast #2\\ndefini
;SETTING_3 tion = ultimaker3_extended\\n\\n[metadata]\\nquality_type = draft\\nt
;SETTING_3 ype = quality_changes\\n\\n[values]\\nsupport_enable = True\\n\\n"}
If I work on that last bit a little more to format it into something other than JSON soup:
{"extruder_quality": ["[general]
version = 4
name = Fast #2
definition = ultimaker3_extended
[metadata]
quality_type = draft
position = 0
type = quality_changes
[values]
infill_pattern = grid
wall_thickness = 2",
"[general]
version = 4
name = Fast #2
definition = ultimaker3
[metadata]
quality_type = draft
position = 1
type = quality_changes
[values]"],
"global_quality": "[general]
version = 4
name = Fast #2
definition = ultimaker3_extended
[metadata]
quality_type = draft
type = quality_changes
[values]
support_enable = True"}
Some wild YAML appears! Neat. Wasn't expecting that from my initial glance.
When I detect a print, should I download and parse the gcode to pull out print-specific parameters and put them in the summary? It can be done, probably pretty easy, since Cura annotates the gcode.
Seems like
/print_job/gcode
or/print_job/container
would do it, though I think they require API authentication so there are some under-the-hood workarounds to do too.