summaryrefslogtreecommitdiff
path: root/lib/svg/path.py
diff options
context:
space:
mode:
authorLex Neva <lexelby@users.noreply.github.com>2018-09-29 14:00:36 -0600
committerGitHub <noreply@github.com>2018-09-29 14:00:36 -0600
commit8830eb7d40befa78c24de84694c69ab958384cac (patch)
treeeff5809a68c0c37375a5e31be8ba57763938b2dd /lib/svg/path.py
parent5139c13fd7f43bb4d829e3c8225c51268e4d27d1 (diff)
new extension: split satin (#315)
This branch adds a new command to split a satin column at a specified point. The split happens at a stitch boundary to ensure that the two resulting satins sew just like the original. All parameters set on the original satin remain set on the two new satins, and all rungs are retained. If one of the satins would have no rungs left, a new rung is added. How to use: 1. Select a satin column (simple satin doesn't work) 2. Attach the "Satin split point" command using the "Attach commands to selected objects" extension. 3. Move the symbol (or just the connector line's endpoint) to point to the exact spot you want the satin to be split at. 4. Select the satin column again. 5. Run "Split Satin Column". 6. The split point command and connector line disappear, and nothing else appears to have happened. Select your satin and you'll see that it's been split. This extension is a by-product of my initial work on #214. Ink/Stitch will need the ability to split a satin at an arbitrary point, and I figured, why not go ahead and release that functionality as an extension while I'm at it? :)
Diffstat (limited to 'lib/svg/path.py')
-rw-r--r--lib/svg/path.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/svg/path.py b/lib/svg/path.py
index 4502b2ea..abaeda52 100644
--- a/lib/svg/path.py
+++ b/lib/svg/path.py
@@ -47,3 +47,16 @@ def get_correction_transform(node, child=False):
transform = simpletransform.invertTransform(transform)
return simpletransform.formatTransform(transform)
+
+
+def line_strings_to_csp(line_strings):
+ csp = []
+
+ for ls in line_strings:
+ subpath = []
+ for point in ls.coords:
+ # create a straight line as a degenerate bezier
+ subpath.append((point, point, point))
+ csp.append(subpath)
+
+ return csp