summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md3
-rw-r--r--embroider.py29
2 files changed, 28 insertions, 4 deletions
diff --git a/README.md b/README.md
index bea95999..7df32fc8 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,7 @@
# inkscape-embroidery: An Inkscape plugin for designing machine embroidery patterns
+
+**NEW December 6, 2017:** [video demo of how to use the extension](https://www.youtube.com/watch?v=qXntE1X1RIw)
+
## Introduction
**Want to design embroidery pattern files (PES, DST, etc) using free, open source software? Hate all the other options? Try this one.**
diff --git a/embroider.py b/embroider.py
index b7edc011..7ad9ee22 100644
--- a/embroider.py
+++ b/embroider.py
@@ -11,6 +11,7 @@
# http://www.achatina.de/sewing/main/TECHNICL.HTM
import sys
+import traceback
sys.path.append("/usr/share/inkscape/extensions")
import os
import subprocess
@@ -692,7 +693,7 @@ class AutoFill(Fill):
# heuristic: change the order I visit the nodes in the outline if necessary.
# If the start and endpoints are in the same row, I can't tell which row
# I should treat it as being in.
- while True:
+ for i in xrange(len(nodes)):
row0 = self.row_num(PyEmb.Point(*nodes[0]), angle, row_spacing)
row1 = self.row_num(PyEmb.Point(*nodes[1]), angle, row_spacing)
@@ -988,7 +989,8 @@ class AutoFill(Fill):
direction = math.copysign(1.0, distance)
one_stitch = self.running_stitch_length * direction
- print >> dbg, "connect_points:", start, end, distance, stitches, direction
+ print >> dbg, "connect_points:", outline_index, start, end, distance, stitches, direction
+ dbg.flush()
patch.add_stitch(PyEmb.Point(*start))
@@ -1001,6 +1003,9 @@ class AutoFill(Fill):
if (end - patch.stitches[-1]).length() > 0.1 * self.options.pixels_per_mm:
patch.add_stitch(end)
+ print >> dbg, "end connect_points"
+ dbg.flush()
+
def path_to_patch(self, graph, path, angle, row_spacing, max_stitch_length):
path = self.collapse_sequential_outline_edges(graph, path)
@@ -1021,6 +1026,9 @@ class AutoFill(Fill):
def do_auto_fill(self, angle, row_spacing, max_stitch_length, starting_point=None):
patches = []
+ print >> dbg, "start do_auto_fill"
+ dbg.flush()
+
rows_of_segments = self.intersect_region_with_grating(angle, row_spacing)
segments = [segment for row in rows_of_segments for segment in row]
@@ -1034,6 +1042,9 @@ class AutoFill(Fill):
patches.append(self.path_to_patch(graph, path, angle, row_spacing, max_stitch_length))
+ print >> dbg, "end do_auto_fill"
+ dbg.flush()
+
return patches
@@ -1052,6 +1063,9 @@ class AutoFill(Fill):
patches.extend(self.do_auto_fill(self.angle, self.row_spacing, self.max_stitch_length, starting_point))
+ print >> dbg, "end AutoFill.to_patches"
+ dbg.flush()
+
return patches
@@ -1736,7 +1750,7 @@ def stitches_to_polylines(stitches):
# last_color = None
- if stitch.color != last_color or stitch.jump_stitch:
+ if stitch.color != last_color:
polylines.append([stitch.color, []])
polylines[-1][1].append(stitch.as_tuple())
@@ -1918,7 +1932,14 @@ class Embroider(inkex.Effect):
if __name__ == '__main__':
sys.setrecursionlimit(100000)
e = Embroider()
- e.affect()
+
+ try:
+ e.affect()
+ except KeyboardInterrupt:
+ print >> dbg, "interrupted!"
+
+ print >> dbg, traceback.format_exc()
+
dbg.flush()
dbg.close()