summaryrefslogtreecommitdiff
path: root/lib/stitches/guided_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/guided_fill.py
parent30c73dc39c1ac814d0c63ec102c7f8c2b993fdd0 (diff)
parentf6c2aa89197c82cedfb31465fc4b2acffaeb8f25 (diff)
Merge pull request #2045 from inkstitch/lexelby/interruptible-threads
make simulator threads interruptible
Diffstat (limited to 'lib/stitches/guided_fill.py')
-rw-r--r--lib/stitches/guided_fill.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/stitches/guided_fill.py b/lib/stitches/guided_fill.py
index a9906bfb..4c441b32 100644
--- a/lib/stitches/guided_fill.py
+++ b/lib/stitches/guided_fill.py
@@ -15,6 +15,7 @@ from ..utils.geometry import (ensure_geometry_collection,
from .auto_fill import (auto_fill, build_fill_stitch_graph, build_travel_graph,
collapse_sequential_outline_edges, find_stitch_path,
graph_is_valid, travel)
+from ..utils.threading import check_stop_flag
def guided_fill(shape,
@@ -68,6 +69,8 @@ def path_to_stitches(path, travel_graph, fill_stitch_graph, stitch_length, runni
stitches.append(Stitch(*path[0].nodes[0]))
for edge in path:
+ check_stop_flag()
+
if edge.is_segment():
current_edge = fill_stitch_graph[edge[0]][edge[-1]]['segment']
path_geometry = current_edge['geometry']
@@ -233,6 +236,8 @@ def intersect_region_with_grating_guideline(shape, line, row_spacing, num_stagge
offset_line = None
rows = []
while True:
+ check_stop_flag()
+
if strategy == 0:
translate_amount = translate_direction * row * row_spacing
offset_line = translate(line, xoff=translate_amount.x, yoff=translate_amount.y)