From 3d9f5dc6d9d106973dc636b1512d0ce26720ce34 Mon Sep 17 00:00:00 2001 From: Pierre Bedell Date: Thu, 5 May 2022 09:55:26 +0200 Subject: [PATCH] metadata: expanded IceSL's support Signed-off-by: Pierre Bedell pierre.bedell@gmail.com --- moonraker/components/file_manager/metadata.py | 48 +++++++++++++++---- 1 file changed, 40 insertions(+), 8 deletions(-) diff --git a/moonraker/components/file_manager/metadata.py b/moonraker/components/file_manager/metadata.py index cb1a208..b425d87 100644 --- a/moonraker/components/file_manager/metadata.py +++ b/moonraker/components/file_manager/metadata.py @@ -747,33 +747,65 @@ class IdeaMaker(BaseSlicer): class IceSL(BaseSlicer): def check_identity(self, data) -> Optional[Dict[str, Any]]: - match = re.search(r"; ", data) + match = re.search(r"", data) if match: - return {'slicer': "IceSL"} + version = match.group(1) if match.group(1)[0].isdigit() else "-" + return { + 'slicer': "IceSL", + 'slicer_version': version + } return None def parse_first_layer_height(self) -> Optional[float]: return _regex_find_first( - r"; z_layer_height_first_layer_mm :\s+(\d+\.\d+)", + r";\sz_layer_height_first_layer_mm\s:\s+(\d+\.\d+)", self.header_data) def parse_layer_height(self) -> Optional[float]: self.layer_height = _regex_find_first( - r"; z_layer_height_mm :\s+(\d+\.\d+)", + r";\sz_layer_height_mm\s:\s+(\d+\.\d+)", self.header_data) return self.layer_height def parse_object_height(self) -> Optional[float]: - return self._parse_max_float( - r"G0 F\d+ Z\d+\.\d+", self.footer_data, strict=True) + return _regex_find_first( + r";\sprint_height_mm\s:\s+(\d+\.\d+)", self.header_data) def parse_first_layer_extr_temp(self) -> Optional[float]: return _regex_find_first( - r"; extruder_temp_degree_c_0 :\s+(\d+\.?\d*)", self.header_data) + r";\sextruder_temp_degree_c_0\s:\s+(\d+\.?\d*)", self.header_data) def parse_first_layer_bed_temp(self) -> Optional[float]: return _regex_find_first( - r"; bed_temp_degree_c :\s+(\d+\.?\d*)", self.header_data) + r";\sbed_temp_degree_c\s:\s+(\d+\.?\d*)", self.header_data) + + def parse_filament_total(self) -> Optional[float]: + return _regex_find_first( + r";\sfilament_used_mm\s:\s+(\d+\.\d+)", self.header_data) + + def parse_filament_weight_total(self) -> Optional[float]: + return _regex_find_first( + r";\sfilament_used_g\s:\s+(\d+\.\d+)", self.header_data) + + def parse_filament_name(self) -> Optional[str]: + return _regex_find_string( + r";\sfilament_name\s:\s+(.*)", self.header_data) + + def parse_filament_type(self) -> Optional[str]: + return _regex_find_string( + r";\sfilament_type\s:\s+(.*)", self.header_data) + + def parse_estimated_time(self) -> Optional[float]: + return _regex_find_first( + r";\sestimated_print_time_s\s:\s+(\d*\.*\d*)", self.header_data) + + def parse_layer_count(self) -> Optional[int]: + return _regex_find_int( + r";\slayer_count\s:\s+(\d+)", self.header_data) + + def parse_nozzle_diameter(self) -> Optional[float]: + return _regex_find_first( + r";\snozzle_diameter_mm_0\s:\s+(\d+\.\d+)", self.header_data) READ_SIZE = 512 * 1024