diff options
| author | Kaalleen <36401965+kaalleen@users.noreply.github.com> | 2023-04-13 16:44:22 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-13 16:44:22 +0200 |
| commit | 3ef31628cb52532d6233fa693b5c6867935f3502 (patch) | |
| tree | 832ed2a1e729057d28a4291f44f70d07c1f90b49 /lib/extensions/select_elements.py | |
| parent | c7819c4971ba7ad0974ab385aaa56dcfe53466ee (diff) | |
Select embroidery elements: autorun underpath selection (#2187)
Diffstat (limited to 'lib/extensions/select_elements.py')
| -rw-r--r-- | lib/extensions/select_elements.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/extensions/select_elements.py b/lib/extensions/select_elements.py index 8fa9ca9d..896e04b0 100644 --- a/lib/extensions/select_elements.py +++ b/lib/extensions/select_elements.py @@ -21,6 +21,7 @@ class SelectElements(InkstitchExtension): pars.add_argument("--info", type=str, dest="info") pars.add_argument("--select-running-stitch", type=Boolean, dest="running", default=False) + pars.add_argument("--running-stitch-condition", type=str, dest="running_stitch_condition", default="all") pars.add_argument("--select-ripples", type=Boolean, dest="ripples", default=False) pars.add_argument("--select-zigzag", type=Boolean, dest="zigzag", default=False) pars.add_argument("--select-manual", type=Boolean, dest="manual", default=False) @@ -101,7 +102,7 @@ class SelectElements(InkstitchExtension): def _select_stroke(self, element): select = False method = element.stroke_method - if self.options.running and method == 'running_stitch': + if self.options.running and method == 'running_stitch' and self._running_condition(element): select = True if self.options.ripples and method == 'ripple_stitch': select = True @@ -130,6 +131,11 @@ class SelectElements(InkstitchExtension): select = True return select + def _running_condition(self, element): + element_id = element.node.get_id() or '' + conditions = {'all': True, 'autorun-top': element_id.startswith('autorun'), 'autorun-underpath': element_id.startswith('underpath')} + return conditions[self.options.running_stitch_condition] + def _select_fill_underlay(self, element): underlay = {'all': True, 'no': not element.fill_underlay, 'yes': element.fill_underlay} return underlay[self.options.fill_underlay] |
