From b4612539585c1e9f4e75e0ad084da81f0ad758d3 Mon Sep 17 00:00:00 2001 From: Lex Neva Date: Mon, 30 Jan 2023 23:55:18 -0500 Subject: make simulator threads pre-emptible --- lib/stitches/fill.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lib/stitches/fill.py') diff --git a/lib/stitches/fill.py b/lib/stitches/fill.py index 11c9259b..b3bb0bb7 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): @@ -169,6 +170,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 -- cgit v1.2.3 From f6c2aa89197c82cedfb31465fc4b2acffaeb8f25 Mon Sep 17 00:00:00 2001 From: Lex Neva Date: Sun, 5 Feb 2023 22:33:38 -0500 Subject: add more check_stop_flag() calls --- lib/stitches/fill.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/stitches/fill.py') diff --git a/lib/stitches/fill.py b/lib/stitches/fill.py index b3bb0bb7..3bd7761d 100644 --- a/lib/stitches/fill.py +++ b/lib/stitches/fill.py @@ -140,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()] -- cgit v1.2.3