extract_metadata: attempt to parse object height from PrusaSlicer comments

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Arksine 2020-09-26 11:43:16 -04:00
parent 756492f349
commit 8440a10b9e
1 changed files with 9 additions and 0 deletions

View File

@ -136,6 +136,15 @@ class PrusaSlicer(BaseSlicer):
r"; layer_height = (\d+\.?\d*)", self.footer_data) r"; layer_height = (\d+\.?\d*)", self.footer_data)
def parse_object_height(self): 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) return self._parse_max_float(r"G1\sZ\d+\.\d*\sF", self.footer_data)
def parse_filament_total(self): def parse_filament_total(self):