diff options
| author | Kaalleen <36401965+kaalleen@users.noreply.github.com> | 2025-07-12 07:58:49 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-12 07:58:49 +0200 |
| commit | 407713ae1a580f740fd9e485a73b6fa96b4bcf43 (patch) | |
| tree | d02468c4fc1b245b19e8726aeedf378f04372892 | |
| parent | 2235ec6571601e12be7eb3c74907668fb68bebd4 (diff) | |
satin: fix empty rail issue (#3863)
| -rw-r--r-- | lib/elements/satin_column.py | 6 |
1 files changed, 5 insertions, 1 deletions
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: |
