summaryrefslogtreecommitdiff
path: root/lib/stitches/fill.py
diff options
context:
space:
mode:
authorLex Neva <lexelby@users.noreply.github.com>2023-02-16 22:58:10 -0500
committerGitHub <noreply@github.com>2023-02-16 22:58:10 -0500
commit7aee0979be4f39cde7a6396cdc0d1d2cc4222d90 (patch)
tree1123050a6ba7428dbcc8b72bd074161bdb3e014f /lib/stitches/fill.py
parent30c73dc39c1ac814d0c63ec102c7f8c2b993fdd0 (diff)
parentf6c2aa89197c82cedfb31465fc4b2acffaeb8f25 (diff)
Merge pull request #2045 from inkstitch/lexelby/interruptible-threads
make simulator threads interruptible
Diffstat (limited to 'lib/stitches/fill.py')
-rw-r--r--lib/stitches/fill.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/stitches/fill.py b/lib/stitches/fill.py
index 11c9259b..3bd7761d 100644
--- a/lib/stitches/fill.py
+++ b/lib/stitches/fill.py
@@ -11,6 +11,7 @@ from ..stitch_plan import Stitch
from ..svg import PIXELS_PER_MM
from ..utils import Point as InkstitchPoint
from ..utils import cache
+from ..utils.threading import check_stop_flag
def legacy_fill(shape, angle, row_spacing, end_row_spacing, max_stitch_length, flip, staggers, skip_last):
@@ -139,6 +140,8 @@ def intersect_region_with_grating(shape, angle, row_spacing, end_row_spacing=Non
current_row_y = start
rows = []
while current_row_y < end:
+ check_stop_flag()
+
p0 = center + normal * current_row_y + direction * half_length
p1 = center + normal * current_row_y - direction * half_length
endpoints = [p0.as_tuple(), p1.as_tuple()]
@@ -169,6 +172,8 @@ def intersect_region_with_grating(shape, angle, row_spacing, end_row_spacing=Non
else:
current_row_y += row_spacing
+ check_stop_flag()
+
return rows