Skip to content

Commit

Permalink
Add S3D processor (#197)
Browse files Browse the repository at this point in the history
  • Loading branch information
smartin015 committed Jan 18, 2023
1 parent d2bf4e0 commit 696d543
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
2 changes: 1 addition & 1 deletion continuousprint/data/printer_profiles.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ PrinterProfile:
clearBed: Pause
finished: Generic Off
depth: 210
extra_tags: []
extra_tags: ["MK3", "MK3S"]
formFactor: rectangular
height: 210
make: Prusa
Expand Down
20 changes: 19 additions & 1 deletion continuousprint/scripts/extract_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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] .*")
Expand Down
5 changes: 5 additions & 0 deletions continuousprint/scripts/test_extract_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 696d543

Please sign in to comment.