From b40c3739497439b2eee9e4d78116a8d6ee27b178 Mon Sep 17 00:00:00 2001 From: Lex Neva Date: Thu, 9 Aug 2018 14:52:42 -0400 Subject: bugfix: don't crash on tiny objects --- lib/elements/fill.py | 5 ++++- messages.po | 13 ++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/lib/elements/fill.py b/lib/elements/fill.py index 8018b2b4..394f523e 100644 --- a/lib/elements/fill.py +++ b/lib/elements/fill.py @@ -105,9 +105,12 @@ class Fill(EmbroideryElement): last_pt = pt else: last_pt = pt - if point_ary: + if len(point_ary) > 2: poly_ary.append(point_ary) + if not poly_ary: + self.fatal(_("shape %s is so small that it cannot be filled with stitches. Please make it bigger or delete it.") % self.node.get('id')) + # shapely's idea of "holes" are to subtract everything in the second set # from the first. So let's at least make sure the "first" thing is the # biggest path. diff --git a/messages.po b/messages.po index 70900191..d2fefa2a 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-08-05 20:33-0400\n" +"POT-Creation-Date: 2018-08-09 14:52-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -92,6 +92,13 @@ msgstr "" msgid "Stagger rows this many times before repeating" msgstr "" +#: lib/elements/fill.py:84 +#, python-format +msgid "" +"shape %s is so small that it cannot be filled with stitches. Please make" +" it bigger or delete it." +msgstr "" + #: lib/elements/satin_column.py:10 msgid "Satin Column" msgstr "" @@ -494,13 +501,13 @@ msgstr "" msgid "Press Q to close the simulation window" msgstr "" -#: lib/stitches/auto_fill.py:167 +#: lib/stitches/auto_fill.py:168 msgid "" "Unable to autofill. This most often happens because your shape is made " "up of multiple sections that aren't connected." msgstr "" -#: lib/stitches/auto_fill.py:392 +#: lib/stitches/auto_fill.py:393 msgid "" "Unexpected error while generating fill stitches. Please send your SVG " "file to lexelby@github." -- cgit v1.2.3