metadata: support multiple filament lengths for prusaslicer

Signed-off-by: Aleksey Frolov <bakatrouble@gmail.com>
This commit is contained in:
bakatrouble 2024-03-06 03:42:59 +03:00 committed by GitHub
parent f0ae51792f
commit 6b1b8c5102
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 3 deletions

View File

@ -357,9 +357,14 @@ class PrusaSlicer(BaseSlicer):
return regex_find_max_float(r"G1\sZ(%F)\sF", self.footer_data) return regex_find_max_float(r"G1\sZ(%F)\sF", self.footer_data)
def parse_filament_total(self) -> Optional[float]: def parse_filament_total(self) -> Optional[float]:
return regex_find_float( line = regex_find_string(r'filament\sused\s\[mm\]\s=\s(%S)\n', self.footer_data)
r"filament\sused\s\[mm\]\s=\s(%F)", self.footer_data if line:
) filament = regex_find_floats(
r"(%F)", line
)
if filament:
return sum(filament)
return None
def parse_filament_weight_total(self) -> Optional[float]: def parse_filament_weight_total(self) -> Optional[float]:
return regex_find_float( return regex_find_float(