From c2bba7fe961e5f7875fb85e5f8f3653bfca06004 Mon Sep 17 00:00:00 2001 From: Kaalleen Date: Mon, 6 Jun 2022 12:47:03 +0200 Subject: [PATCH] autorun keep all attributes (also the ripple attribs) --- lib/stitches/auto_run.py | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/lib/stitches/auto_run.py b/lib/stitches/auto_run.py index 91a998497..4656bc5dc 100644 --- a/lib/stitches/auto_run.py +++ b/lib/stitches/auto_run.py @@ -258,24 +258,28 @@ def create_element(path, position, direction, element): else: label = _("AutoRun Underpath %d") % index - stitch_length = element.node.get(INKSTITCH_ATTRIBS['running_stitch_length_mm'], '') - bean = element.node.get(INKSTITCH_ATTRIBS['bean_stitch_repeats'], 0) - repeats = int(element.node.get(INKSTITCH_ATTRIBS['repeats'], 1)) - if repeats % 2 == 0: - repeats -= 1 - node = inkex.PathElement() node.set("id", generate_unique_id(element.node, el_id)) node.set(INKSCAPE_LABEL, label) node.set("d", path) node.set("style", str(style)) - if stitch_length: - node.set(INKSTITCH_ATTRIBS['running_stitch_length_mm'], stitch_length) - if direction == "autorun": - node.set(INKSTITCH_ATTRIBS['repeats'], str(repeats)) - if bean: - node.set(INKSTITCH_ATTRIBS['bean_stitch_repeats'], bean) + # Set Ink/Stitch attributes + stitch_length = element.node.get(INKSTITCH_ATTRIBS['running_stitch_length_mm'], '') + repeats = int(element.node.get(INKSTITCH_ATTRIBS['repeats'], 1)) + if repeats % 2 == 0: + repeats -= 1 + + if direction == "autorun": + for attrib in element.node.attrib: + if attrib.startswith(inkex.NSS['inkstitch'], 1): + if attrib == INKSTITCH_ATTRIBS['repeats']: + node.set(INKSTITCH_ATTRIBS['repeats'], str(repeats)) + else: + node.set(attrib, element.node.get(attrib)) + else: + if stitch_length: + node.set(INKSTITCH_ATTRIBS['running_stitch_length_mm'], stitch_length) return Stroke(node)