From dbef888e4d07fbd8dd840d160266768e41c894a2 Mon Sep 17 00:00:00 2001 From: Lex Neva Date: Sun, 24 Aug 2025 09:14:09 -0400 Subject: fix crash with tiny satin (#3934) * avoid crash on tiny satin * cleanup small satins too * fix #3933 --------- Co-authored-by: Kaalleen --- lib/elements/satin_column.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lib/elements/satin_column.py') diff --git a/lib/elements/satin_column.py b/lib/elements/satin_column.py index 62252ddb..4951f8bf 100644 --- a/lib/elements/satin_column.py +++ b/lib/elements/satin_column.py @@ -611,6 +611,10 @@ class SatinColumn(EmbroideryElement): self.pull_compensation_percent/100, True, ) + if len(pairs) == 1: + # we need at least two points for line string creation + # if there is only one, we simply duplicate it to prevent an error + pairs.append(pairs[0]) rail1 = [point[0] for point in pairs] rail2 = [point[1] for point in pairs] return shgeo.MultiLineString((rail1, rail2)) @@ -1110,6 +1114,10 @@ class SatinColumn(EmbroideryElement): points = [points[0] for points in pairs] stitches = running_stitch.even_running_stitch(points, self.running_stitch_length, self.running_stitch_tolerance) + + if len(stitches) == 1: + stitches.append(stitches[0]) + return stitches def _stitch_distance(self, pos0, pos1, previous_pos0, previous_pos1): -- cgit v1.2.3