From 1c2dc2d95442b3663eebf1e2b633f3bb388982c0 Mon Sep 17 00:00:00 2001 From: Lex Neva Date: Sat, 1 Sep 2018 20:06:39 -0400 Subject: add error message for invalid geometries (#216) --- lib/elements/fill.py | 5 ++++- messages.po | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/elements/fill.py b/lib/elements/fill.py index 626573e6..4156a24b 100644 --- a/lib/elements/fill.py +++ b/lib/elements/fill.py @@ -120,7 +120,10 @@ class Fill(EmbroideryElement): poly_ary.sort(key=lambda point_list: shgeo.Polygon(point_list).area, reverse=True) polygon = shgeo.MultiPolygon([(poly_ary[0], poly_ary[1:])]) - # print >> sys.stderr, "polygon valid:", polygon.is_valid + + if not polygon.is_valid: + self.fatal(_("shape is not valid. This can happen if the border crosses over itself.")) + return polygon def to_patches(self, last_patch): diff --git a/messages.po b/messages.po index 7d14b239..f477151e 100644 --- a/messages.po +++ b/messages.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2018-09-01 19:54-0400\n" +"POT-Creation-Date: 2018-09-01 20:06-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -264,6 +264,10 @@ msgid "" " it bigger or delete it." msgstr "" +#: lib/elements/fill.py:125 +msgid "shape is not valid. This can happen if the border crosses over itself." +msgstr "" + #: lib/elements/satin_column.py:10 msgid "Satin Column" msgstr "" -- cgit v1.3.1