From 9e174a1b6893625a8e3c6c8b262168018cae94c5 Mon Sep 17 00:00:00 2001 From: fiksupojka Date: Tue, 3 Sep 2024 12:06:40 +0200 Subject: [PATCH] Read info abouy abrasive material and high-flow nozzle --- pybgcode/pybgcode/__init__.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pybgcode/pybgcode/__init__.py b/pybgcode/pybgcode/__init__.py index 5987891..3e7120d 100644 --- a/pybgcode/pybgcode/__init__.py +++ b/pybgcode/pybgcode/__init__.py @@ -144,7 +144,8 @@ def read_metadata(gcodefile: FILEWrapper, type: str = 'printer'): "support_material", "ironing", "quiet_percent_present", "quiet_left_present", "quiet_change_in_present", "normal_percent_present", "normal_left_present", "normal_change_in_present", "layer_info_present", - "max_layer_z", "objects_info", "extruder_colour"] + "max_layer_z", "objects_info", "extruder_colour", "filament_abrasive", + "nozzle_high_flow"] def filter_connect_metadata(output: dict) -> dict: @@ -157,7 +158,7 @@ def filter_connect_metadata(output: dict) -> dict: def read_connect_metadata(wrapper: FILEWrapper): """Read metadata from binary gcode file.""" - output = {'print': None, 'thumbnails': [], 'printer': None} + output: dict = {'print': {}, 'thumbnails': [], 'printer': {}} # read file header res, header = get_header(wrapper) @@ -185,7 +186,7 @@ def read_connect_metadata(wrapper: FILEWrapper): if res != EResult.Success: raise ResultError(res) output['printer'] = dict( - metadata_block.raw_data) if metadata_block else None + metadata_block.raw_data) if metadata_block else {} elif block_header.type == 4: # print metdata - we need them metadata_block = PrintMetadataBlock() @@ -194,8 +195,7 @@ def read_connect_metadata(wrapper: FILEWrapper): if res != EResult.Success: raise ResultError(res) output['print'] = dict( - metadata_block.raw_data) if metadata_block else None - return filter_connect_metadata(output) + metadata_block.raw_data) if metadata_block else {} elif block_header.type == 5: # thumbnails block thumbnail_block = ThumbnailBlock()