From f6ffacb8e8907bd02791de62b9e8fd4ad8a66b6c Mon Sep 17 00:00:00 2001 From: "sarka.faloutova" Date: Thu, 29 Aug 2024 12:22:10 +0200 Subject: [PATCH] resin_used_ml as usedMaterial in config.json --- gcode_metadata/metadata.py | 6 ++++-- tests/test_metadata.py | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/gcode_metadata/metadata.py b/gcode_metadata/metadata.py index ed85405..10f871d 100644 --- a/gcode_metadata/metadata.py +++ b/gcode_metadata/metadata.py @@ -782,7 +782,8 @@ def __init__(self, key_to_parse: str): "expTimeFirst": "exposure_time_first", "layerHeight": "layer_height", "materialName": "material", - "printerModel": "printer_model" + "printerModel": "printer_model", + "usedMaterial": "resin_used_ml", } @staticmethod @@ -813,7 +814,8 @@ class SLMetaData(MetaData): "exposure_time_first": int, "total_layers": int, "total_height": int, - "resin_used_ml": int, + # to unify with filament used [mm] rounded to 2 decimal places + "resin_used_ml": lambda x: round(float(x), 2), "printer_model": str, } diff --git a/tests/test_metadata.py b/tests/test_metadata.py index efe271c..c7fbed7 100644 --- a/tests/test_metadata.py +++ b/tests/test_metadata.py @@ -338,7 +338,8 @@ def test_sl(self): 'exposure_time_first': 25, 'layer_height': 0.05, 'material': 'Prusament Resin Tough Prusa Orange @0.05 SL1S', - 'printer_model': 'SL1S' + 'printer_model': 'SL1S', + 'resin_used_ml': 17.15, } assert len(meta.thumbnails["400x400_PNG"]) == 26948