diff options
| author | Kaalleen <36401965+kaalleen@users.noreply.github.com> | 2025-11-07 17:10:03 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-11-07 17:10:03 +0100 |
| commit | 5a9ae03dc14ea5b68a99581c21a5d8085f1a3243 (patch) | |
| tree | 4b729fbdc8656f3ba75b7dfdd2ccfecdd8718fee /lib/elements/stroke.py | |
| parent | 383f164b6d90c0819d49f4fb16deb9efa3e11df2 (diff) | |
Running stitch length sequence (#4034)
* allow running stitch length sequences
* contour fill: fix error message for long stitch length
* satin: fix center underlay stitch length
Diffstat (limited to 'lib/elements/stroke.py')
| -rw-r--r-- | lib/elements/stroke.py | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/lib/elements/stroke.py b/lib/elements/stroke.py index 58cc5756..f0f44827 100644 --- a/lib/elements/stroke.py +++ b/lib/elements/stroke.py @@ -118,14 +118,15 @@ class Stroke(EmbroideryElement): @property @param('running_stitch_length_mm', _('Running stitch length'), - tooltip=_('Length of stitches. Stitches can be shorter according to the stitch tolerance setting.'), + tooltip=_('Length of stitches. Stitches can be shorter according to the stitch tolerance setting.\n' + 'It is possible to create stitch length patterns by adding multiple values separated by a space.'), unit='mm', - type='float', + type='string', select_items=[('stroke_method', 'running_stitch'), ('stroke_method', 'ripple_stitch')], - default=2.5, + default="2.5", sort_index=4) def running_stitch_length(self): - return max(self.get_float_param("running_stitch_length_mm", 2.5), 0.01) + return [max(value, 0.01) for value in self.get_multiple_float_param("running_stitch_length_mm", "2.5")] @property @param('running_stitch_tolerance_mm', @@ -185,13 +186,13 @@ class Stroke(EmbroideryElement): _('Zig-zag spacing (peak-to-peak)'), tooltip=_('Length of stitches in zig-zag mode.'), unit='mm', - type='float', - default=0.4, + type='string', + default="0.4", select_items=[('stroke_method', 'zigzag_stitch')], sort_index=6) @cache def zigzag_spacing(self): - return max(self.get_float_param("zigzag_spacing_mm", 0.4), 0.01) + return [max(value, 0.01) for value in self.get_multiple_float_param("zigzag_spacing_mm", "0.4")] @property @param('stroke_pull_compensation_mm', @@ -551,7 +552,8 @@ class Stroke(EmbroideryElement): # `self.zigzag_spacing` is the length for a zig and a zag # together (a V shape). Start with running stitch at half # that length: - stitch_group = self.running_stitch(path, zigzag_spacing / 2.0, self.running_stitch_tolerance, False, 0, "") + spacing = [value / 2 for value in zigzag_spacing] + stitch_group = self.running_stitch(path, spacing, self.running_stitch_tolerance, False, 0, "") stitch_group.stitches = zigzag_stitch(stitch_group.stitches, zigzag_spacing, stroke_width, pull_compensation) return stitch_group |
