From 407713ae1a580f740fd9e485a73b6fa96b4bcf43 Mon Sep 17 00:00:00 2001 From: Kaalleen <36401965+kaalleen@users.noreply.github.com> Date: Sat, 12 Jul 2025 07:58:49 +0200 Subject: satin: fix empty rail issue (#3863) --- lib/elements/satin_column.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib/elements') diff --git a/lib/elements/satin_column.py b/lib/elements/satin_column.py index 3a29aca7..51a10cad 100644 --- a/lib/elements/satin_column.py +++ b/lib/elements/satin_column.py @@ -643,6 +643,10 @@ class SatinColumn(EmbroideryElement): if reverse: paths[i] = shgeo.LineString(paths[i].coords[::-1]) + # if one of the rails has no nodes, return an empty tuple + if any([path.is_empty for path in paths]): + return tuple() + return tuple(paths) @property @@ -723,7 +727,7 @@ class SatinColumn(EmbroideryElement): # This takes advantage of the fact that sum() counts True as 1 intersection_counts = [sum(paths[i].intersects(paths[j]) for j in range(num_paths) if i != j) for i in range(num_paths)] - paths_not_intersecting_two = [i for i in range(num_paths) if intersection_counts[i] != 2] + paths_not_intersecting_two = [i for i in range(num_paths) if intersection_counts[i] != 2 and paths[i].length > 0.001] num_not_intersecting_two = len(paths_not_intersecting_two) if num_not_intersecting_two == 2: -- cgit v1.2.3