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 From 63effb841fa3ea507135e10331b8ecb1a64e94dd Mon Sep 17 00:00:00 2001 From: Lex Neva Date: Mon, 3 Apr 2023 22:59:02 -0400 Subject: add meander angle --- lib/elements/fill_stitch.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'lib/elements/fill_stitch.py') diff --git a/lib/elements/fill_stitch.py b/lib/elements/fill_stitch.py index 7b146a36..8f22278b 100644 --- a/lib/elements/fill_stitch.py +++ b/lib/elements/fill_stitch.py @@ -185,9 +185,21 @@ class FillStitch(EmbroideryElement): def meander_pattern(self): return self.get_param('meander_pattern', min(tiles.all_tiles()).id) + @property + @param('meander_angle', + _('Meander pattern angle'), + type='float', unit="degrees", + default=0, + select_items=[('fill_method', 'meander_fill')], + sort_index=4) + def meander_angle(self): + return math.radians(self.get_float_param('meander_angle', 0)) + @property @param('meander_scale_percent', _('Meander pattern scale'), + tooltip=_("Percentage to stretch or compress the meander pattern. You can scale horizontally " + + "and vertically individually by giving two percentages separated by a space. "), type='float', unit="%", default=100, select_items=[('fill_method', 'meander_fill')], -- cgit v1.2.3