diff options
| author | Stefan Siegl <stesie@brokenpipe.de> | 2014-12-27 17:30:54 +0100 |
|---|---|---|
| committer | Stefan Siegl <stesie@brokenpipe.de> | 2014-12-27 17:30:54 +0100 |
| commit | 4aef2789a2914a15b2a6d091718898c644d1e7cc (patch) | |
| tree | 2da1e2efb7622caaa77f173a489e68d220fab5ac /PyEmb.py | |
| parent | ea07ab6f108f4ec4af3fec43104e0467e206b92e (diff) | |
Add Embroidermodder 2 CSV export
Diffstat (limited to 'PyEmb.py')
| -rw-r--r-- | PyEmb.py | 24 |
1 files changed, 24 insertions, 0 deletions
@@ -144,6 +144,30 @@ class Embroidery: self.pos = stitch return self.str + def export_csv(self, dbg): + self.str = "" + self.str += '"#","[THREAD_NUMBER]","[RED]","[GREEN]","[BLUE]","[DESCRIPTION]","[CATALOG_NUMBER]"\n' + self.str += '"#","[STITCH_TYPE]","[X]","[Y]"\n' + + lastColor = None + colorIndex = 0 + for stitch in self.coords: + if lastColor == None or stitch.color != lastColor: + colorIndex += 1 + self.str += '"$","%d","%d","%d","%d","(null)","(null)"\n' % ( + colorIndex, + int(stitch.color[1:3], 16), + int(stitch.color[3:5], 16), + int(stitch.color[5:7], 16)) + if stitch.jumpStitch: + self.str += '"*","JUMP","%f","%f"\n' % (stitch.x/10, stitch.y/10) + if lastColor != None and stitch.color != lastColor: + # not first color choice, add color change record + self.str += '"*","COLOR","%f","%f"\n' % (stitch.x/10, stitch.y/10) + self.str += '"*","STITCH","%f","%f"\n' % (stitch.x/10, stitch.y/10) + lastColor = stitch.color + return self.str + class Test: def __init__(self): emb = Embroidery() |
