diff options
| author | Lex Neva <github@lexneva.name> | 2017-09-23 02:42:58 +0100 |
|---|---|---|
| committer | Lex Neva <github@lexneva.name> | 2017-09-23 02:42:58 +0100 |
| commit | 60d14f777f56cfcf9c50b3b0be8e19e78e8ec532 (patch) | |
| tree | 9e34fcdd0b3fa4099d76321c57a88148ca95f3a8 | |
| parent | 4b8fa119429299a9f087dc4019b3bd7ad5f57429 (diff) | |
fix handling of starting point / last stitch
| -rw-r--r-- | embroider.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/embroider.py b/embroider.py index 9d51419e..ee9c4a24 100644 --- a/embroider.py +++ b/embroider.py @@ -1006,20 +1006,19 @@ class AutoFill(Fill): def to_patches(self, last_patch): - print >> dbg, "autofill", self.max_stitch_length, self.fill_underlay_max_stitch_length - patches = [] if last_patch is None: - last_stitch = None + starting_point = None else: - last_stitch = last_patch.stitches[-1] + nearest_point = self.outline.interpolate(self.outline.project(shgeo.Point(last_patch.stitches[-1]))) + starting_point = PyEmb.Point(*nearest_point.coords[0]) if self.fill_underlay: - patches.extend(self.do_auto_fill(self.fill_underlay_angle, self.fill_underlay_row_spacing, self.fill_underlay_max_stitch_length, last_stitch)) - last_stitch = patches[-1].stitches[-1] + patches.extend(self.do_auto_fill(self.fill_underlay_angle, self.fill_underlay_row_spacing, self.fill_underlay_max_stitch_length, starting_point)) + starting_point = patches[-1].stitches[-1] - patches.extend(self.do_auto_fill(self.angle, self.row_spacing, self.max_stitch_length, last_stitch)) + patches.extend(self.do_auto_fill(self.angle, self.row_spacing, self.max_stitch_length, starting_point)) return patches |
