diff options
| author | Lex Neva <github@lexneva.name> | 2016-01-08 22:56:10 -0500 |
|---|---|---|
| committer | Lex Neva <github@lexneva.name> | 2016-01-08 22:56:10 -0500 |
| commit | 3e3d54008937e0195c88143986ab6dc44c21facb (patch) | |
| tree | e2de12664b0f3f25bccc255c1391131f6750914e /PyEmb.py | |
| parent | 142f0a5681a8406ecb5f408d8d23f85a8410c81c (diff) | |
major revamp
* properly process transform parameters (ungrouping no longer necessary!)
* handle satin on beziers properly
* previously beziers were stroked as straight line segments that included control points
* allow overriding parameters on individual paths by adding extra svg params
* embroider_angle, embroider_stitch_length, embroider_zigzag_spacing, embroider_row_spacing, etc
* set using "Edit XML"
* default to 10 pixels per millimeter
* properly write CSV files in millimeters (was dividing by 10)
* always translate pattern to origin to fit in hoop
* add "running stitch length" for < 0.5 stroke width)
* don't traceback if no paths were selected
* add "repeats" option for stroke (satin/running stitch) to go back and forth over the line
* good for a double line of center-line underlay below satin
Diffstat (limited to 'PyEmb.py')
| -rw-r--r-- | PyEmb.py | 15 |
1 files changed, 10 insertions, 5 deletions
@@ -63,9 +63,14 @@ class Embroidery: maxy = max(maxy,p.y) sx = maxx-minx sy = maxy-miny + + self.translate(-minx, -miny) + return (minx, miny) + + def translate(self, dx, dy): for p in self.coords: - p.x -= minx - p.y -= miny + p.x += dx + p.y += dy def scale(self, sc): if not isinstance(sc, (tuple, list)): @@ -160,11 +165,11 @@ class Embroidery: 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) + 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/10, stitch.y/10) - self.str += '"*","STITCH","%f","%f"\n' % (stitch.x/10, stitch.y/10) + self.str += '"*","COLOR","%f","%f"\n' % (stitch.x, stitch.y) + self.str += '"*","STITCH","%f","%f"\n' % (stitch.x, stitch.y) lastColor = stitch.color return self.str |
