diff options
| author | Lex Neva <github@lexneva.name> | 2016-02-13 22:12:35 -0500 |
|---|---|---|
| committer | Lex Neva <github@lexneva.name> | 2016-02-13 22:12:35 -0500 |
| commit | 5635eca31555b8feda58036e35f1112310821616 (patch) | |
| tree | 27f1cafa640d6e937b7f40d86ef118c60b3bf2ca /PyEmb.py | |
| parent | 13dcbf8846fe08a229537772ac82f504ebc3e2ee (diff) | |
color change BEFORE jump stitch
Diffstat (limited to 'PyEmb.py')
| -rw-r--r-- | PyEmb.py | 11 |
1 files changed, 5 insertions, 6 deletions
@@ -154,10 +154,12 @@ class Embroidery: self.str += '"#","[THREAD_NUMBER]","[RED]","[GREEN]","[BLUE]","[DESCRIPTION]","[CATALOG_NUMBER]"\n' self.str += '"#","[STITCH_TYPE]","[X]","[Y]"\n' - lastColor = None + lastStitch = None colorIndex = 0 for stitch in self.coords: - if lastColor == None or stitch.color != lastColor: + if lastStitch is not None and stitch.color != lastStitch.color: + self.str += '"*","COLOR","%f","%f"\n' % (lastStitch.x, lastStitch.y) + if lastStitch is None or stitch.color != lastStitch.color: colorIndex += 1 self.str += '"$","%d","%d","%d","%d","(null)","(null)"\n' % ( colorIndex, @@ -166,11 +168,8 @@ class Embroidery: int(stitch.color[5:7], 16)) if stitch.jumpStitch: self.str += '"*","JUMP","%f","%f"\n' % (stitch.x, stitch.y) - if lastColor != None and stitch.color != lastColor: - # not first color choice, add color change record - self.str += '"*","COLOR","%f","%f"\n' % (stitch.x, stitch.y) self.str += '"*","STITCH","%f","%f"\n' % (stitch.x, stitch.y) - lastColor = stitch.color + lastStitch = stitch return self.str def export_gcode(self, dbg): |
