summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaalleen <36401965+kaalleen@users.noreply.github.com>2023-06-27 07:44:34 +0200
committerGitHub <noreply@github.com>2023-06-27 07:44:34 +0200
commit52ba1afb7532514adee18939f37c51805642f235 (patch)
treec6544a0312ead30409fa27ffa1619ca70badce15
parent4c562a71273d44e05efe64d4d37bd02c61448691 (diff)
filter satins for auto route satin (#2389)
-rw-r--r--lib/elements/satin_column.py2
-rw-r--r--lib/extensions/auto_satin.py9
2 files changed, 9 insertions, 2 deletions
diff --git a/lib/elements/satin_column.py b/lib/elements/satin_column.py
index dc883dea..e48973ac 100644
--- a/lib/elements/satin_column.py
+++ b/lib/elements/satin_column.py
@@ -830,6 +830,8 @@ class SatinColumn(EmbroideryElement):
def center_line(self):
# similar technique to do_center_walk()
center_walk = [p[0] for p in self.plot_points_on_rails(self.zigzag_spacing, (0, 0), (-0.5, -0.5))]
+ if len(center_walk) < 2:
+ center_walk = [center_walk[0], center_walk[0]]
return shgeo.LineString(center_walk)
def offset_points(self, pos1, pos2, offset_px, offset_proportional):
diff --git a/lib/extensions/auto_satin.py b/lib/extensions/auto_satin.py
index dfb1a87e..badc9d55 100644
--- a/lib/extensions/auto_satin.py
+++ b/lib/extensions/auto_satin.py
@@ -63,7 +63,12 @@ class AutoSatin(CommandsExtension):
starting_point = self.get_starting_point()
ending_point = self.get_ending_point()
- # Ignore fills
- elements = [element for element in self.elements if isinstance(element, SatinColumn) or isinstance(element, Stroke)]
+ # Ignore fills and zero length satins
+ elements = [element for element in self.elements if (isinstance(element, SatinColumn) and element.center_line.length != 0) or
+ isinstance(element, Stroke)]
+
+ # at this point we possibly removed all the elements, in this case stop here
+ if not elements:
+ return
auto_satin(elements, self.options.preserve_order, starting_point, ending_point, self.options.trim)