From 8440a10b9e7a9e8fec53a90d57959380fd8753c5 Mon Sep 17 00:00:00 2001 From: Arksine Date: Sat, 26 Sep 2020 11:43:16 -0400 Subject: [PATCH] extract_metadata: attempt to parse object height from PrusaSlicer comments Signed-off-by: Eric Callahan --- scripts/extract_metadata.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/scripts/extract_metadata.py b/scripts/extract_metadata.py index ebce8dc..859d96a 100644 --- a/scripts/extract_metadata.py +++ b/scripts/extract_metadata.py @@ -136,6 +136,15 @@ class PrusaSlicer(BaseSlicer): r"; layer_height = (\d+\.?\d*)", self.footer_data) def parse_object_height(self): + matches = re.findall( + r";BEFORE_LAYER_CHANGE\n(?:.*\n)?;(\d+\.?\d*)", self.footer_data) + if matches: + try: + matches = [float(m) for m in matches] + except Exception: + pass + else: + return max(matches) return self._parse_max_float(r"G1\sZ\d+\.\d*\sF", self.footer_data) def parse_filament_total(self):