From 0c527cc51e896f57d15c399c28c8c66c16d1cc59 Mon Sep 17 00:00:00 2001 From: Lex Neva Date: Fri, 22 Jun 2018 22:29:23 -0400 Subject: starting point specified by fill_start command --- lib/elements/auto_fill.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'lib/elements/auto_fill.py') diff --git a/lib/elements/auto_fill.py b/lib/elements/auto_fill.py index 504bae2a..a2c63bd9 100644 --- a/lib/elements/auto_fill.py +++ b/lib/elements/auto_fill.py @@ -100,13 +100,21 @@ class AutoFill(Fill): def fill_shape(self): return self.shrink_or_grow_shape(self.expand) + def get_starting_point(self, last_patch): + # If there is a "fill_start" Command, then use that; otherwise pick + # the point closest to the end of the last patch. + + if self.get_command('fill_start'): + return self.get_command('fill_start').target_point + elif last_patch: + return last_patch.stitches[-1] + else: + return None + def to_patches(self, last_patch): stitches = [] - if last_patch is None: - starting_point = None - else: - starting_point = last_patch.stitches[-1] + starting_point = self.get_starting_point(last_patch) if self.fill_underlay: stitches.extend(auto_fill(self.underlay_shape, -- cgit v1.2.3 From abbda62835bfc99e49d0de1ccdffb6739dd2142e Mon Sep 17 00:00:00 2001 From: Lex Neva Date: Fri, 22 Jun 2018 22:31:42 -0400 Subject: ending point speciifed by fill_end command --- lib/elements/auto_fill.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'lib/elements/auto_fill.py') diff --git a/lib/elements/auto_fill.py b/lib/elements/auto_fill.py index a2c63bd9..59816878 100644 --- a/lib/elements/auto_fill.py +++ b/lib/elements/auto_fill.py @@ -111,10 +111,17 @@ class AutoFill(Fill): else: return None + def get_ending_point(self): + if self.get_command('fill_end'): + return self.get_command('fill_end').target_point + else: + return None + def to_patches(self, last_patch): stitches = [] starting_point = self.get_starting_point(last_patch) + ending_point = self.get_ending_point() if self.fill_underlay: stitches.extend(auto_fill(self.underlay_shape, @@ -134,6 +141,7 @@ class AutoFill(Fill): self.max_stitch_length, self.running_stitch_length, self.staggers, - starting_point)) + starting_point, + ending_point)) return [Patch(stitches=stitches, color=self.color)] -- cgit v1.2.3