diff options
| author | Lex Neva <github.com@lexneva.name> | 2019-06-19 15:20:43 -0400 |
|---|---|---|
| committer | Lex Neva <github.com@lexneva.name> | 2019-06-22 18:12:57 -0400 |
| commit | 249c876ef559e8b2a614cb19caa426351fa43075 (patch) | |
| tree | 50d3f351c0f9dcc8a535210f1e8d9f034cb5abf5 /lib/elements | |
| parent | f0315604291ede89798dc3342eb0c001574e1c5f (diff) | |
better message for unconnected fill shapes (fixes #463)
Diffstat (limited to 'lib/elements')
| -rw-r--r-- | lib/elements/fill.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/elements/fill.py b/lib/elements/fill.py index 4bdfa3ff..7ccf7b27 100644 --- a/lib/elements/fill.py +++ b/lib/elements/fill.py @@ -1,6 +1,7 @@ import math from shapely import geometry as shgeo +from shapely.validation import explain_validity from ..i18n import _ from ..stitches import legacy_fill @@ -112,7 +113,15 @@ class Fill(EmbroideryElement): polygon = shgeo.MultiPolygon([(paths[0], paths[1:])]) if not polygon.is_valid: - self.fatal(_("shape is not valid. This can happen if the border crosses over itself.")) + why = explain_validity(polygon) + + # I Wish this weren't so brittle... + if "Hole lies outside shell" in why: + self.fatal(_("this object is made up of unconnected shapes. This is not allowed because " + "Ink/Stitch doesn't know what order to stitch them in. Please break this " + "object up into separate shapes.")) + else: + self.fatal(_("shape is not valid. This can happen if the border crosses over itself.")) return polygon |
