diff options
| author | Kaalleen <36401965+kaalleen@users.noreply.github.com> | 2023-03-16 16:32:46 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-03-16 16:32:46 +0100 |
| commit | 29b72801cd0973559ac04b584d376286f58746ff (patch) | |
| tree | e97fd3cd9aba9c39ca40bf848b20d0edcfd1724c /lib/stitches | |
| parent | 0b0704c300efedd88fb4691b3d3cffc341fa3476 (diff) | |
Auto route satin: apply path effects (#2145)
Diffstat (limited to 'lib/stitches')
| -rw-r--r-- | lib/stitches/auto_satin.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/stitches/auto_satin.py b/lib/stitches/auto_satin.py index 228f1325..09f331bf 100644 --- a/lib/stitches/auto_satin.py +++ b/lib/stitches/auto_satin.py @@ -6,25 +6,25 @@ import math from itertools import chain +import inkex import networkx as nx from shapely import geometry as shgeo from shapely.geometry import Point as ShapelyPoint -import inkex - from ..commands import add_commands from ..elements import SatinColumn, Stroke from ..i18n import _ from ..svg import PIXELS_PER_MM, generate_unique_id, line_strings_to_csp -from ..svg.tags import INKSCAPE_LABEL, INKSTITCH_ATTRIBS +from ..svg.tags import (INKSCAPE_LABEL, INKSTITCH_ATTRIBS, ORIGINAL_D, + PATH_EFFECT) from ..utils import Point as InkstitchPoint from ..utils import cache, cut +from ..utils.threading import check_stop_flag from .utils.autoroute import (add_elements_to_group, add_jumps, create_new_group, find_path, get_starting_and_ending_nodes, preserve_original_groups, remove_original_elements) -from ..utils.threading import check_stop_flag class SatinSegment(object): @@ -331,6 +331,14 @@ def auto_satin(elements, preserve_order=False, starting_point=None, ending_point parent = elements[0].node.getparent() index = parent.index(elements[0].node) + # apply live path effects + # It would be nice if we could preserve them, but this could have unwanted side effects + # if the path needs to be broken up for better routing + for element in elements: + if element.node.get(PATH_EFFECT, None): + element.node.pop(PATH_EFFECT) + element.node.pop(ORIGINAL_D) + graph = build_graph(elements, preserve_order) add_jumps(graph, elements, preserve_order) starting_node, ending_node = get_starting_and_ending_nodes( |
