diff options
| author | Kaalleen <36401965+kaalleen@users.noreply.github.com> | 2022-06-10 16:23:44 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-06-10 16:23:44 +0200 |
| commit | 68deec88a8a8c4e469191d8c00641a1077c2508a (patch) | |
| tree | 488602606d70e524ad43185ae2bb033276137626 /lib/stitches | |
| parent | 55a94f2dc089ed49460f80e7e1728a41dec73a53 (diff) | |
Satin center walk underlay repeats (#1671)
Diffstat (limited to 'lib/stitches')
| -rw-r--r-- | lib/stitches/auto_satin.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/stitches/auto_satin.py b/lib/stitches/auto_satin.py index ba5c8698..93bffd57 100644 --- a/lib/stitches/auto_satin.py +++ b/lib/stitches/auto_satin.py @@ -507,6 +507,7 @@ def name_elements(new_elements, preserve_order): for element in new_elements: if isinstance(element, SatinColumn): element.node.set("id", generate_unique_id(element.node, "autosatin")) + _ensure_even_repeats(element) else: element.node.set("id", generate_unique_id(element.node, "autosatinrun")) @@ -514,6 +515,7 @@ def name_elements(new_elements, preserve_order): if isinstance(element, SatinColumn): # L10N Label for a satin column created by Auto-Route Satin Columns and Lettering extensions element.node.set(INKSCAPE_LABEL, _("AutoSatin %d") % index) + _ensure_even_repeats(element) else: # L10N Label for running stitch (underpathing) created by Auto-Route Satin Columns amd Lettering extensions element.node.set(INKSCAPE_LABEL, _("AutoSatin Running Stitch %d") % index) @@ -521,6 +523,14 @@ def name_elements(new_elements, preserve_order): index += 1 +def _ensure_even_repeats(element): + # center underlay can have an odd number of repeats, this would cause jumps in auto route satin + # so let's set it to an even number of repeats, but not lower than 2 + if int(element.node.get(INKSTITCH_ATTRIBS['center_walk_underlay_repeats'], 2)) % 2 == 1: + repeats = max(int(element.node.get(INKSTITCH_ATTRIBS['center_walk_underlay_repeats'])) - 1, 2) + element.node.set(INKSTITCH_ATTRIBS['center_walk_underlay_repeats'], repeats) + + def add_trims(elements, trim_indices): """Add trim commands on the specified elements. |
