metadata: Add support for Kiri:Moto and SimplyPrint

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Eric Callahan 2022-03-21 15:23:32 -04:00
parent 5d4db16fd6
commit cd8954e36c
No known key found for this signature in database
GPG Key ID: 5A1EB336DFB4C71B
1 changed files with 62 additions and 1 deletions

View File

@ -807,11 +807,72 @@ class IceSL(BaseSlicer):
return _regex_find_first(
r";\snozzle_diameter_mm_0\s:\s+(\d+\.\d+)", self.header_data)
class KiriMoto(BaseSlicer):
def check_identity(self, data) -> Optional[Dict[str, Any]]:
variants: Dict[str, str] = {
"Kiri:Moto": r"; Generated by Kiri:Moto (\d.+)",
"SimplyPrint": r"; Generated by Kiri:Moto \(SimplyPrint\) (.+)"
}
for name, pattern in variants.items():
match = re.search(pattern, data)
if match:
return {
"slicer": name,
"slicer_version": match.group(1)
}
return None
def parse_first_layer_height(self) -> Optional[float]:
return _regex_find_first(
r"; firstSliceHeight = (\d+\.\d+)", self.header_data
)
def parse_layer_height(self) -> Optional[float]:
self.layer_height = _regex_find_first(
r"; sliceHeight = (\d+\.\d+)", self.header_data
)
return self.layer_height
def parse_object_height(self) -> Optional[float]:
return self._parse_max_float(
r"G1 Z\d+\.\d+ (?:; z-hop end|F\d+\n)",
self.footer_data, strict=True
)
def parse_layer_count(self) -> Optional[int]:
matches = re.findall(
r";; --- layer (\d+) \(.+", self.footer_data
)
if not matches:
return None
try:
return int(matches[-1]) + 1
except Exception:
return None
def parse_estimated_time(self) -> Optional[float]:
return _regex_find_int(r"; --- print time: (\d+)s", self.footer_data)
def parse_filament_total(self) -> Optional[float]:
return _regex_find_first(
r"; --- filament used: (\d+\.?\d*) mm", self.footer_data
)
def parse_first_layer_extr_temp(self) -> Optional[float]:
return _regex_find_first(
r"; firstLayerNozzleTemp = (\d+\.?\d*)", self.header_data
)
def parse_first_layer_bed_temp(self) -> Optional[float]:
return _regex_find_first(
r"; firstLayerBedTemp = (\d+\.?\d*)", self.header_data
)
READ_SIZE = 512 * 1024
SUPPORTED_SLICERS: List[Type[BaseSlicer]] = [
PrusaSlicer, Slic3rPE, Slic3r, Cura, Simplify3D,
KISSlicer, IdeaMaker, IceSL
KISSlicer, IdeaMaker, IceSL, KiriMoto
]
SUPPORTED_DATA = [
'gcode_start_byte',