diff options
| author | Lex Neva <lexelby@users.noreply.github.com> | 2023-02-16 22:58:10 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-02-16 22:58:10 -0500 |
| commit | 7aee0979be4f39cde7a6396cdc0d1d2cc4222d90 (patch) | |
| tree | 1123050a6ba7428dbcc8b72bd074161bdb3e014f /lib/stitches/contour_fill.py | |
| parent | 30c73dc39c1ac814d0c63ec102c7f8c2b993fdd0 (diff) | |
| parent | f6c2aa89197c82cedfb31465fc4b2acffaeb8f25 (diff) | |
Merge pull request #2045 from inkstitch/lexelby/interruptible-threads
make simulator threads interruptible
Diffstat (limited to 'lib/stitches/contour_fill.py')
| -rw-r--r-- | lib/stitches/contour_fill.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/stitches/contour_fill.py b/lib/stitches/contour_fill.py index 86a55406..885a7e6c 100644 --- a/lib/stitches/contour_fill.py +++ b/lib/stitches/contour_fill.py @@ -15,6 +15,7 @@ from ..utils import DotDict from ..utils.geometry import (cut, ensure_geometry_collection, ensure_multi_polygon, reverse_line_string, roll_linear_ring) +from ..utils.threading import check_stop_flag from .running_stitch import running_stitch @@ -132,6 +133,8 @@ def offset_polygon(polygon, offset, join_style, clockwise): active_holes[0].append(hole_node) while len(active_polygons) > 0: + check_stop_flag() + current_poly = active_polygons.pop() current_holes = active_holes.pop() @@ -325,6 +328,7 @@ def _find_path_inner_to_outer(tree, node, offset, starting_point, avoid_self_cro Return value: LineString -- the stitching path """ + check_stop_flag() current_node = tree.nodes[node] current_ring = current_node.val @@ -473,6 +477,8 @@ def _check_and_prepare_tree_for_valid_spiral(tree): """ def process_node(node): + check_stop_flag() + children = set(tree[node]) if len(children) == 0: @@ -526,6 +532,8 @@ def _get_spiral_rings(tree): node = 'root' while True: + check_stop_flag() + rings.append(tree.nodes[node].val) children = tree[node] @@ -556,6 +564,8 @@ def _make_spiral(rings, stitch_length, starting_point): path = [] for ring1, ring2 in zip(rings[:-1], rings[1:]): + check_stop_flag() + spiral_part = _interpolate_linear_rings(ring1, ring2, stitch_length, starting_point) path.extend(spiral_part.coords) |
