diff options
| author | Lex Neva <github.com@lexneva.name> | 2018-07-07 15:31:59 -0400 |
|---|---|---|
| committer | Lex Neva <github.com@lexneva.name> | 2018-07-07 15:31:59 -0400 |
| commit | ac84d7b0d4365b61b5a375b8c4497a81093cc734 (patch) | |
| tree | 9c39a5bea9c02e0a17af592c4603ced4fb8cbf19 /lib/extensions/flip.py | |
| parent | 8c009e381ef6bc0ea702dd59c7a91687043279eb (diff) | |
fix brain-o
Diffstat (limited to 'lib/extensions/flip.py')
| -rw-r--r-- | lib/extensions/flip.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/extensions/flip.py b/lib/extensions/flip.py index 75d8fe17..d8d78cb5 100644 --- a/lib/extensions/flip.py +++ b/lib/extensions/flip.py @@ -1,19 +1,25 @@ import sys import inkex import cubicsuperpath +from shapely import geometry as shgeo from .base import InkstitchExtension from ..i18n import _ from ..elements import SatinColumn class Flip(InkstitchExtension): + def subpath_to_linestring(self, subpath): + return shgeo.LineString() + def flip(self, satin): - csp = cubicsuperpath.parsePath(satin.node.get("d")) + csp = satin.path if len(csp) > 1: + flattened = satin.flatten(csp) + # find the rails (the two longest paths) and swap them indices = range(len(csp)) - indices.sort(key=lambda i: len(csp[i]), reverse=True) + indices.sort(key=lambda i: shgeo.LineString(flattened[i]).length, reverse=True) first = indices[0] second = indices[1] |
