diff --git a/gcode_metadata/metadata.py b/gcode_metadata/metadata.py index 164739b..5920678 100644 --- a/gcode_metadata/metadata.py +++ b/gcode_metadata/metadata.py @@ -563,6 +563,7 @@ def set_attr(self, name, value): "normal_change_in_present": bool, "layer_info_present": bool, "max_layer_z": float, + "objects_info": json.loads, } # Add attributes that have multiple values in MMU print gcodes diff --git a/tests/gcodes/fdn_full_0.15mm_PETG_MK3S_2h6m.gcode b/tests/gcodes/fdn_full_0.15mm_PETG_MK3S_2h6m.gcode index cd35591..a155f1e 100644 --- a/tests/gcodes/fdn_full_0.15mm_PETG_MK3S_2h6m.gcode +++ b/tests/gcodes/fdn_full_0.15mm_PETG_MK3S_2h6m.gcode @@ -209977,6 +209977,7 @@ M73 Q100 S0 ; notes = ; nozzle_diameter = 0.4 ; nozzle_high_flow = 0 +; objects_info = {"objects":[{"name":"Shape-Box id:0 copy 0","polygon":[[111.000,111.000],[93.000,111.000],[93.000,93.000],[111.000,93.000]]},{"name":"Shape-Box id:0 copy 1","polygon":[[87.000,111.000],[69.000,111.000],[69.000,93.000],[87.000,93.000]]},{"name":"Shape-Box id:0 copy 2","polygon":[[111.000,87.000],[93.000,87.000],[93.000,69.000],[111.000,69.000]]},{"name":"Shape-Box id:0 copy 3","polygon":[[87.000,87.000],[69.000,87.000],[69.000,69.000],[87.000,69.000]]}]} ; only_retract_when_crossing_perimeters = 0 ; ooze_prevention = 0 ; output_filename_format = {input_filename_base}_{layer_height}mm_{filament_type[0]}_{printer_model}_{print_time}.gcode diff --git a/tests/test_metadata.py b/tests/test_metadata.py index b317047..47d8b24 100644 --- a/tests/test_metadata.py +++ b/tests/test_metadata.py @@ -230,6 +230,48 @@ def test_full(self): 'normal_percent_present': True, 'quiet_left_present': True, 'quiet_percent_present': True, + # objects don't match up with the actually printed objects + # this is expected - I have copied object info from another file + 'objects_info': { + "objects": [ + { + "name": "Shape-Box id:0 copy 0", + "polygon": [ + [111.000, 111.000], + [93.000, 111.000], + [93.000, 93.000], + [111.000, 93.000] + ] + }, + { + "name": "Shape-Box id:0 copy 1", + "polygon": [ + [87.000, 111.000], + [69.000, 111.000], + [69.000, 93.000], + [87.000, 93.000] + ] + }, + { + "name": "Shape-Box id:0 copy 2", + "polygon": [ + [111.000, 87.000], + [93.000, 87.000], + [93.000, 69.000], + [111.000, 69.000] + ] + }, + { + "name": "Shape-Box id:0 copy 3", + "polygon": [ + [87.000, 87.000], + [69.000, 87.000], + [69.000, 69.000], + [87.000, 69.000] + ] + } + ] + } } assert len(meta.thumbnails['640x480_PNG']) == 158644