summaryrefslogtreecommitdiff
path: root/embroider.py
diff options
context:
space:
mode:
Diffstat (limited to 'embroider.py')
-rw-r--r--embroider.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/embroider.py b/embroider.py
index b6e0ab51..68abda5f 100644
--- a/embroider.py
+++ b/embroider.py
@@ -865,6 +865,7 @@ class AutoFill(Fill):
the order of most-recently-visited first.
"""
+ original_graph = graph
graph = graph.copy()
num_segments = len(segments)
segments_visited = 0
@@ -900,6 +901,11 @@ class AutoFill(Fill):
#if segments_visited >= 12:
# break
+ # Now we have a loop that covers every grating segment. It returns to
+ # where it started, which is unnecessary, so we'll snip the last bit off.
+ while original_graph.has_edge(*path[-1], key="outline"):
+ path.pop()
+
return path
def collapse_sequential_outline_edges(self, graph, path):
@@ -992,9 +998,6 @@ class AutoFill(Fill):
graph = self.build_graph(segments, angle, row_spacing)
path = self.find_stitch_path(graph, segments)
- # snip off the last one because it just unnecessarily returns to the start
- path.pop()
-
if starting_point:
patch = Patch(self.color)
self.connect_points(patch, starting_point, path[0][0])