summaryrefslogtreecommitdiff
path: root/lib/marker.py
diff options
context:
space:
mode:
authorKaalleen <36401965+kaalleen@users.noreply.github.com>2022-06-10 16:25:30 +0200
committerGitHub <noreply@github.com>2022-06-10 16:25:30 +0200
commit2fde596272b339ebb9b63ceebd66c5e7a0c641f2 (patch)
tree8beb5a62880fc66026551fca7fe4676de456029a /lib/marker.py
parent68deec88a8a8c4e469191d8c00641a1077c2508a (diff)
Guided ripple stitch (#1675)
Co-authored-by: @lexelby
Diffstat (limited to 'lib/marker.py')
-rw-r--r--lib/marker.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/marker.py b/lib/marker.py
index 56a43c3b..17d4bebd 100644
--- a/lib/marker.py
+++ b/lib/marker.py
@@ -6,9 +6,10 @@
from copy import deepcopy
from os import path
-import inkex
from shapely import geometry as shgeo
+import inkex
+
from .svg.tags import EMBROIDERABLE_TAGS
from .utils import cache, get_bundled_dir
@@ -39,12 +40,14 @@ def set_marker(node, position, marker):
node.set('style', ";".join(style))
-def get_marker_elements(node, marker, get_fills=True, get_strokes=True):
+def get_marker_elements(node, marker, get_fills=True, get_strokes=True, get_satins=False):
from .elements import EmbroideryElement
+ from .elements.satin_column import SatinColumn
from .elements.stroke import Stroke
fills = []
strokes = []
+ satins = []
xpath = "./parent::svg:g/*[contains(@style, 'marker-start:url(#inkstitch-%s-marker)')]" % marker
markers = node.xpath(xpath, namespaces=inkex.NSS)
for marker in markers:
@@ -66,7 +69,12 @@ def get_marker_elements(node, marker, get_fills=True, get_strokes=True):
line_strings = [shgeo.LineString(path) for path in stroke]
strokes.append(shgeo.MultiLineString(line_strings))
- return {'fill': fills, 'stroke': strokes}
+ if get_satins and stroke is not None:
+ satin = SatinColumn(marker)
+ if len(satin.rails) == 2:
+ satins.append(satin)
+
+ return {'fill': fills, 'stroke': strokes, 'satin': satins}
def has_marker(node, marker=list()):