From 60d14f777f56cfcf9c50b3b0be8e19e78e8ec532 Mon Sep 17 00:00:00 2001 From: Lex Neva Date: Sat, 23 Sep 2017 02:42:58 +0100 Subject: fix handling of starting point / last stitch --- embroider.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'embroider.py') 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 -- cgit v1.2.3