diff options
| author | Kaalleen <36401965+kaalleen@users.noreply.github.com> | 2024-03-26 07:10:40 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-26 07:10:40 +0100 |
| commit | 8e70f3d2feaab8a14f775a5ef84002bdab9688f0 (patch) | |
| tree | f34d46ead8eb8d15317dc98de4113ccaf8acd0e9 /lib/elements/element.py | |
| parent | ea394f6d3b7de3bc0818b6a9921f64e8bcbc4fbf (diff) | |
Add object based min stitch length (#2792)
* add object based min stitch length (overwrites global)
* add object based minimum jump stitch (overwrites global)
* rename patches to stitch_groups
Diffstat (limited to 'lib/elements/element.py')
| -rw-r--r-- | lib/elements/element.py | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/lib/elements/element.py b/lib/elements/element.py index 7145571b..6c2fa15a 100644 --- a/lib/elements/element.py +++ b/lib/elements/element.py @@ -219,6 +219,28 @@ class EmbroideryElement(object): return width * self.stroke_scale @property + @param('min_stitch_length_mm', + _('Minimum stitch length'), + tooltip=_('Overwrite global minimum stitch length setting. Shorter stitches than that will be removed.'), + type='float', + default=None, + sort_index=48) + @cache + def min_stitch_length(self): + return self.get_float_param("min_stitch_length_mm") + + @property + @param('min_jump_stitch_length_mm', + _('Minimum jump stitch length'), + tooltip=_('Overwrite global minimum jump stitch length setting. Shorter distances to the next object will have no lock stitches.'), + type='float', + default=None, + sort_index=49) + @cache + def min_jump_stitch_length(self): + return self.get_float_param("min_jump_stitch_length_mm") + + @property @param('ties', _('Allow lock stitches'), tooltip=_('Tie thread at the beginning and/or end of this object. ' @@ -472,7 +494,7 @@ class EmbroideryElement(object): return lock_start, lock_end - def to_stitch_groups(self, last_patch): + def to_stitch_groups(self, last_stitch_group): raise NotImplementedError("%s must implement to_stitch_groups()" % self.__class__.__name__) @debug.time @@ -576,6 +598,10 @@ class EmbroideryElement(object): stitch_groups[-1].trim_after = self.has_command("trim") or self.trim_after stitch_groups[-1].stop_after = self.has_command("stop") or self.stop_after + for stitch_group in stitch_groups: + stitch_group.min_jump_stitch_length = self.min_jump_stitch_length + stitch_group.set_minimum_stitch_length(self.min_stitch_length) + self._save_cached_stitch_groups(stitch_groups, previous_stitch) debug.log(f"ending {self.node.get('id')} {self.node.get(INKSCAPE_LABEL)}") |
