From c01fb85c3d6e7d6a30282cb0a4db8d511b4d4f86 Mon Sep 17 00:00:00 2001 From: Lex Neva Date: Sun, 2 Apr 2023 14:16:16 -0400 Subject: add clip option --- lib/elements/fill_stitch.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'lib/elements/fill_stitch.py') diff --git a/lib/elements/fill_stitch.py b/lib/elements/fill_stitch.py index 980103a4..7b146a36 100644 --- a/lib/elements/fill_stitch.py +++ b/lib/elements/fill_stitch.py @@ -553,6 +553,16 @@ class FillStitch(EmbroideryElement): def expand(self): return self.get_float_param('expand_mm', 0) + @property + @param('clip', _('Clip path'), + tooltip=_('Constrain stitching to the shape. Useful when smoothing and expand are used.'), + type='boolean', + default=False, + select_items=[('fill_method', 'meander_fill')], + sort_index=6) + def clip(self): + return self.get_boolean_param('clip', False) + @property @param('underpath', _('Underpath'), @@ -648,7 +658,7 @@ class FillStitch(EmbroideryElement): elif self.fill_method == 'guided_fill': stitch_groups.extend(self.do_guided_fill(fill_shape, previous_stitch_group, start, end)) elif self.fill_method == 'meander_fill': - stitch_groups.extend(self.do_meander_fill(fill_shape, i, start, end)) + stitch_groups.extend(self.do_meander_fill(fill_shape, shape, i, start, end)) elif self.fill_method == 'circular_fill': stitch_groups.extend(self.do_circular_fill(fill_shape, previous_stitch_group, start, end)) except ExitThread: @@ -792,11 +802,11 @@ class FillStitch(EmbroideryElement): )) return [stitch_group] - def do_meander_fill(self, shape, i, starting_point, ending_point): + def do_meander_fill(self, shape, original_shape, i, starting_point, ending_point): stitch_group = StitchGroup( color=self.color, tags=("meander_fill", "meander_fill_top"), - stitches=meander_fill(self, shape, i, starting_point, ending_point)) + stitches=meander_fill(self, shape, original_shape, i, starting_point, ending_point)) return [stitch_group] @cache -- cgit v1.2.3