From 022b4cee764c1b1f3e1c4d85a7b27af928878417 Mon Sep 17 00:00:00 2001 From: Florian Festi Date: Thu, 18 Apr 2024 20:46:09 +0200 Subject: [PATCH] RegularStarBox: Error message if box won't work For very small boxes (relative to the thickness) with many corners there may not be space to make the two halves fit together. Issue an ValueError that is shown in the UI. Thanks to DillonSimeone for reporting this! Resolves: #671 --- boxes/generators/regularstarbox.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/boxes/generators/regularstarbox.py b/boxes/generators/regularstarbox.py index 7ba4b2c9f..7890bdf3b 100644 --- a/boxes/generators/regularstarbox.py +++ b/boxes/generators/regularstarbox.py @@ -35,7 +35,9 @@ def __call__(self, length, **kw): if li > 0: poly = [lo-1, (90, 1), d+t-1, -90, ls1+ls2, -90, d-t, (90, t)] - self.polyline(*(poly + [li-2*t] + list(reversed(poly)))) + self.polyline(*(poly + [li-2*t] + list(reversed(poly)))) + else: + raise ValueError("Box is too small and has too many corners to work properly") def startwidth(self) -> float: return self.settings.thickness