diff options
| author | Lex Neva <lexelby@users.noreply.github.com> | 2018-09-29 14:00:36 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-09-29 14:00:36 -0600 |
| commit | 8830eb7d40befa78c24de84694c69ab958384cac (patch) | |
| tree | eff5809a68c0c37375a5e31be8ba57763938b2dd /lib/svg | |
| parent | 5139c13fd7f43bb4d829e3c8225c51268e4d27d1 (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')
| -rw-r--r-- | lib/svg/__init__.py | 2 | ||||
| -rw-r--r-- | lib/svg/path.py | 13 |
2 files changed, 14 insertions, 1 deletions
diff --git a/lib/svg/__init__.py b/lib/svg/__init__.py index 429e6b5e..a56fcca7 100644 --- a/lib/svg/__init__.py +++ b/lib/svg/__init__.py @@ -1,3 +1,3 @@ from .svg import color_block_to_point_lists, render_stitch_plan from .units import * -from .path import apply_transforms, get_node_transform, get_correction_transform +from .path import apply_transforms, get_node_transform, get_correction_transform, line_strings_to_csp 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 |
