summaryrefslogtreecommitdiff
path: root/lib/stitches
diff options
context:
space:
mode:
authorKaalleen <36401965+kaalleen@users.noreply.github.com>2023-07-04 06:27:33 +0200
committerGitHub <noreply@github.com>2023-07-04 06:27:33 +0200
commit795df7e315c3d691717f8b077d4668e5ef31ac64 (patch)
tree1c7c5ea3ebabab2316c6037dcb4737d07f3c165b /lib/stitches
parentc18bc113834f661c2d844cef28d8f46406f9b626 (diff)
avoid error message on small contour fill with single or double spiral (#2403)
Diffstat (limited to 'lib/stitches')
-rw-r--r--lib/stitches/contour_fill.py6
-rw-r--r--lib/stitches/running_stitch.py2
2 files changed, 6 insertions, 2 deletions
diff --git a/lib/stitches/contour_fill.py b/lib/stitches/contour_fill.py
index 2ea61afb..993fa104 100644
--- a/lib/stitches/contour_fill.py
+++ b/lib/stitches/contour_fill.py
@@ -569,6 +569,7 @@ def _make_fermat_spiral(rings, stitch_length, starting_point):
def _make_spiral(rings, stitch_length, starting_point):
path = []
+ spiral_part = None
for ring1, ring2 in zip(rings[:-1], rings[1:]):
check_stop_flag()
@@ -577,7 +578,8 @@ def _make_spiral(rings, stitch_length, starting_point):
# skip last to avoid duplicated points
path.extend(spiral_part.coords[:-1])
- # at the end add last point
- path.append(spiral_part.coords[-1])
+ if spiral_part:
+ # at the end add last point
+ path.append(spiral_part.coords[-1])
return path
diff --git a/lib/stitches/running_stitch.py b/lib/stitches/running_stitch.py
index 29e2547d..b6262a45 100644
--- a/lib/stitches/running_stitch.py
+++ b/lib/stitches/running_stitch.py
@@ -249,6 +249,8 @@ def path_to_curves(points: typing.List[Point], min_len: float):
def running_stitch(points, stitch_length, tolerance):
# Turn a continuous path into a running stitch.
+ if not points:
+ return
stitches = [points[0]]
for curve in path_to_curves(points, 2 * tolerance):
# segments longer than twice the tollerance will usually be forced by it, so set that as the minimum for corner detection