summaryrefslogtreecommitdiff
path: root/lib/stitches/auto_satin.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/stitches/auto_satin.py')
-rw-r--r--lib/stitches/auto_satin.py10
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.