diff options
| author | Lex Neva <github@lexneva.name> | 2017-10-17 18:24:45 +0100 |
|---|---|---|
| committer | Lex Neva <github@lexneva.name> | 2017-10-17 18:24:45 +0100 |
| commit | eff59de06dc4e6cf03da0b803fef7928476247d5 (patch) | |
| tree | 942ca461e0e2b0491b913aa6de13e33f3b445b0b /embroider.py | |
| parent | 8744ae054b1325db711e08560af64c137b1b5fa7 (diff) | |
fix snipping of unnecessary outline section
Diffstat (limited to 'embroider.py')
| -rw-r--r-- | embroider.py | 9 |
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]) |
