From eff59de06dc4e6cf03da0b803fef7928476247d5 Mon Sep 17 00:00:00 2001 From: Lex Neva Date: Tue, 17 Oct 2017 18:24:45 +0100 Subject: [PATCH] fix snipping of unnecessary outline section --- embroider.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/embroider.py b/embroider.py index b6e0ab519..68abda5f4 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])