diff options
| author | Lex Neva <github@lexneva.name> | 2017-10-25 03:12:10 +0100 |
|---|---|---|
| committer | Lex Neva <github@lexneva.name> | 2017-10-25 03:12:10 +0100 |
| commit | 806123b6acbb3fdde7a757734085463283a22ef0 (patch) | |
| tree | 5fea0c4e30344f10ac3aec7f0654f2155d2b9e50 /embroider.py | |
| parent | 5986ea4f2289e62a70be6a5f78a1a06e2336ad8d (diff) | |
preserve order of rails in satin with rungs
Diffstat (limited to 'embroider.py')
| -rw-r--r-- | embroider.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/embroider.py b/embroider.py index 01dd56f8..dbf07c1e 100644 --- a/embroider.py +++ b/embroider.py @@ -1271,7 +1271,9 @@ class SatinColumn(EmbroideryElement): def flatten_beziers_with_rungs(self): input_paths = [self.flatten([path]) for path in self.csp] input_paths = [shgeo.LineString(path[0]) for path in input_paths] - input_paths.sort(key=lambda path: path.length, reverse=True) + + paths = input_paths[:] + paths.sort(key=lambda path: path.length, reverse=True) # Imagine a satin column as a curvy ladder. # The two long paths are the "rails" of the ladder. The remainder are @@ -1279,6 +1281,10 @@ class SatinColumn(EmbroideryElement): rails = input_paths[:2] rungs = shgeo.MultiLineString(input_paths[2:]) + # The rails should stay in the order they were in the original CSP. + # (this lets the user control where the satin starts and ends) + rails.sort(key=lambda rail: input_paths.index(rail)) + result = [] for rail in rails: |
