diff --git a/continuousprint/data/printer_profiles.yaml b/continuousprint/data/printer_profiles.yaml index ec08f9b..23edaf5 100644 --- a/continuousprint/data/printer_profiles.yaml +++ b/continuousprint/data/printer_profiles.yaml @@ -305,7 +305,7 @@ PrinterProfile: clearBed: Pause finished: Generic Off depth: 210 - extra_tags: [] + extra_tags: ["MK3", "MK3S"] formFactor: rectangular height: 210 make: Prusa diff --git a/continuousprint/scripts/extract_profile.py b/continuousprint/scripts/extract_profile.py index 2dfbc2a..d883c11 100644 --- a/continuousprint/scripts/extract_profile.py +++ b/continuousprint/scripts/extract_profile.py @@ -50,6 +50,24 @@ def get_profile(self, hdr, ftr) -> str: return "" +class Simplify3DProcessor: + @classmethod + def match(self, hdr, ftr): + for line in hdr: + if line.startswith("; G-Code generated by Simplify3D"): + return True + return False + + @classmethod + def get_profile(self, hdr, ftr) -> str: + for line in hdr: + m = re.match("; profileName,(.*)", line) + print(line, "->", m) + if m is not None: + return m[1] + return "" + + def token_string_match(profstr): # Remove non-alpha characters from profile string # Convert all into bag-of-words @@ -72,7 +90,7 @@ def token_string_match(profstr): PROCESSORS = [ (cls.__name__, cls.match, cls.get_profile) - for cls in [KiriMotoProcessor, PrusaSlicerProcessor] + for cls in [KiriMotoProcessor, PrusaSlicerProcessor, Simplify3DProcessor] ] gcode_move_re = re.compile("^G[012] .*") diff --git a/continuousprint/scripts/test_extract_profile.py b/continuousprint/scripts/test_extract_profile.py index 3611233..11c5636 100644 --- a/continuousprint/scripts/test_extract_profile.py +++ b/continuousprint/scripts/test_extract_profile.py @@ -25,6 +25,11 @@ def testParameterized(self): "; printer_model = MK3S\n", "Prusa i3 MK3S+", ), + ( + "; G-Code generated by Simplify3D(R) Version 4.1.2\n; profileName,Prusa Research Original Prusa i3 MK3", + "", + "Prusa i3 MK3S+", + ), ]: with self.subTest(header=header, footer=footer, want=want): hdr = header.split("\n")