metadata: simplify the S3Dv5 temp regex
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
parent
7845390dd1
commit
522fdab63d
@ -17,7 +17,6 @@ import tempfile
|
|||||||
import zipfile
|
import zipfile
|
||||||
import shutil
|
import shutil
|
||||||
import uuid
|
import uuid
|
||||||
import io
|
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
|
|
||||||
# Annotation imports
|
# Annotation imports
|
||||||
@ -646,35 +645,18 @@ class Simplify3D(BaseSlicer):
|
|||||||
return None
|
return None
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def _get_first_layer_temp_v5(self, type: str) -> Optional[float]:
|
def _get_first_layer_temp_v5(self, heater_type: str) -> Optional[float]:
|
||||||
matches = re.finditer(r";\s+temperatureController.*", self.header_data)
|
pattern = (
|
||||||
|
r";\s+temperatureController,.+?"
|
||||||
for m in matches:
|
r";\s+temperatureType,"f"{heater_type}"r".+?"
|
||||||
typ = None
|
r";\s+temperatureSetpoints,\d+\|(\d+)"
|
||||||
temp = None
|
)
|
||||||
|
match = re.search(pattern, self.header_data, re.MULTILINE | re.DOTALL)
|
||||||
for line in io.StringIO(self.header_data[m.end()+1:]):
|
if match is not None:
|
||||||
if not line.startswith(";"):
|
try:
|
||||||
break
|
return float(match.group(1))
|
||||||
|
except Exception:
|
||||||
if re.search(r";\s+temperatureController", line):
|
return None
|
||||||
break
|
|
||||||
|
|
||||||
val_temp = _regex_find_first(
|
|
||||||
r";\s+temperatureSetpoints,\d+\|(\d+)", line)
|
|
||||||
if val_temp:
|
|
||||||
temp = val_temp
|
|
||||||
|
|
||||||
val_typ = _regex_find_string(r"\s+temperatureType,(.+)", line)
|
|
||||||
if val_typ:
|
|
||||||
typ = val_typ
|
|
||||||
|
|
||||||
if typ and temp:
|
|
||||||
break
|
|
||||||
|
|
||||||
if typ == type:
|
|
||||||
return temp
|
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def parse_first_layer_extr_temp(self) -> Optional[float]:
|
def parse_first_layer_extr_temp(self) -> Optional[float]:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user