From acaebaa956006a0fa064c2361b47f902a8a50b77 Mon Sep 17 00:00:00 2001 From: Lex Neva Date: Tue, 23 Jan 2018 20:13:37 -0500 Subject: add params for "TRIM after" and "STOP after" (#29) * adds new options to Params: "TRIM after" and "STOP after" * adds tooltip support to Params * inkstitch now includes libembroidery and can directly output any supported file type * this avoids the need for `libembroidery-convert` and compiling embroidermodder! * TRIM support for DST format (inserts 3 JUMPs) * STOP command supported as an extra color change that the operator can assign to code C00 * TRIMs cause the following jump stitch not to be displayed in the Embroidery layer --- embroider_simulate.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'embroider_simulate.py') diff --git a/embroider_simulate.py b/embroider_simulate.py index f10f39f0..4b772692 100644 --- a/embroider_simulate.py +++ b/embroider_simulate.py @@ -149,6 +149,7 @@ class EmbroiderySimulator(wx.Frame): return segments def _parse_stitch_file(self, stitch_file_path): + # "#", "comment" # "$","1","229","229","229","(null)","(null)" # "*","JUMP","1.595898","48.731899" # "*","STITCH","1.595898","48.731899" @@ -161,6 +162,10 @@ class EmbroiderySimulator(wx.Frame): with open(stitch_file_path) as stitch_file: for line in stitch_file: + line = line.strip() + if not line: + continue + fields = line.strip().split(",") fields = [self._strip_quotes(field) for field in fields] @@ -180,6 +185,10 @@ class EmbroiderySimulator(wx.Frame): x, y = fields[2:] new_pos = (float(x) * PIXELS_PER_MM, float(y) * PIXELS_PER_MM) + if not segments and new_pos == (0.0, 0.0): + # libembroidery likes to throw an extra JUMP in at the start + continue + if not cut: segments.append(((pos, new_pos), pen)) -- cgit v1.2.3