Skip to content

Commit

Permalink
RegularStarBox: Error message if box won't work
Browse files Browse the repository at this point in the history
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 <https://github.com/DillonSimeone> for reporting
this!

Resolves: #671
  • Loading branch information
florianfesti committed Apr 18, 2024
1 parent 66e2c15 commit 022b4ce
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion boxes/generators/regularstarbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 022b4ce

Please sign in to comment.