summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--embroider.py39
-rw-r--r--images/patches/README.md1
-rw-r--r--images/patches/soulstorm_brew_orig.jpgbin0 -> 42573 bytes
-rw-r--r--images/patches/soulstorm_brew_patch.jpgbin0 -> 1780530 bytes
4 files changed, 21 insertions, 19 deletions
diff --git a/embroider.py b/embroider.py
index b7148b29..b7edc011 100644
--- a/embroider.py
+++ b/embroider.py
@@ -1238,7 +1238,7 @@ class SatinColumn(EmbroideryElement):
return self.get_float_param("zigzag_underlay_spacing_mm", 1)
@property
- @param('zigzag_underlay_inset', 'Inset amount (default: half of contour underlay inset)', unit='mm', group='Zig-zag Underlay', type='float')
+ @param('zigzag_underlay_inset_mm', 'Inset amount (default: half of contour underlay inset)', unit='mm', group='Zig-zag Underlay', type='float')
def zigzag_underlay_inset(self):
# how far in from the edge of the satin the points in the zigzags
# should be
@@ -1724,37 +1724,38 @@ def patches_to_stitches(patch_list, collapse_len_px=0):
return stitches
-
-def stitches_to_paths(stitches):
- paths = []
+def stitches_to_polylines(stitches):
+ polylines = []
last_color = None
last_stitch = None
+
for stitch in stitches:
- if stitch.jump_stitch:
- if last_color == stitch.color:
- paths.append([None, []])
- if last_stitch is not None:
- paths[-1][1].append(['M', last_stitch.as_tuple()])
- paths[-1][1].append(['L', stitch.as_tuple()])
- last_color = None
- if stitch.color != last_color:
- paths.append([stitch.color, []])
- paths[-1][1].append(['L' if len(paths[-1][1]) > 0 else 'M', stitch.as_tuple()])
+ #if stitch.jump_stitch:
+ #if last_color == stitch.color:
+ # polylines.append([None, [last_stitch.as_tuple(), stitch.as_tuple()]])
+
+ # last_color = None
+
+ if stitch.color != last_color or stitch.jump_stitch:
+ polylines.append([stitch.color, []])
+
+ polylines[-1][1].append(stitch.as_tuple())
+
last_color = stitch.color
last_stitch = stitch
- return paths
+ return polylines
def emit_inkscape(parent, stitches):
- for color, path in stitches_to_paths(stitches):
- # dbg.write('path: %s %s\n' % (color, repr(path)))
+ for color, polyline in stitches_to_polylines(stitches):
+ # dbg.write('polyline: %s %s\n' % (color, repr(polyline)))
inkex.etree.SubElement(parent,
- inkex.addNS('path', 'svg'),
+ inkex.addNS('polyline', 'svg'),
{'style': simplestyle.formatStyle(
{'stroke': color if color is not None else '#000000',
'stroke-width': "0.4",
'fill': 'none'}),
- 'd': simplepath.formatPath(path),
+ 'points': " ".join(",".join(str(coord) for coord in point) for point in polyline),
})
diff --git a/images/patches/README.md b/images/patches/README.md
index 27ed3849..4887ade6 100644
--- a/images/patches/README.md
+++ b/images/patches/README.md
@@ -1,3 +1,4 @@
+[<img src="soulstorm_brew_patch.jpg" width="300">](soulstorm_brew_patch.jpg) ![soulstorm_brew_orig.jpg](soulstorm_brew_orig.jpg)
![super_hero_patch.jpg](super_hero_patch.jpg)
![orca_patch.jpg](orca_patch.jpg)
![amazon_checkmark_i.jpg](amazon_checkmark_i.jpg)
diff --git a/images/patches/soulstorm_brew_orig.jpg b/images/patches/soulstorm_brew_orig.jpg
new file mode 100644
index 00000000..4c956e80
--- /dev/null
+++ b/images/patches/soulstorm_brew_orig.jpg
Binary files differ
diff --git a/images/patches/soulstorm_brew_patch.jpg b/images/patches/soulstorm_brew_patch.jpg
new file mode 100644
index 00000000..3fcdf753
--- /dev/null
+++ b/images/patches/soulstorm_brew_patch.jpg
Binary files differ