summaryrefslogtreecommitdiff
path: root/lib/elements/satin_column.py
diff options
context:
space:
mode:
authorGeorge Steel <george.steel@gmail.com>2023-01-28 20:20:40 -0500
committerGeorge Steel <george.steel@gmail.com>2023-01-28 20:20:40 -0500
commitc2c256727bc0c6663d553024783941e25448e06c (patch)
tree6b462ba3a76d6219e618eaf03f46ac3070d92f96 /lib/elements/satin_column.py
parent45496fcd93363659cf3dcebde92d5c86be82dd6c (diff)
parentf2f1fea0cb5d5fe122cc62a338b3b6513528f313 (diff)
Merge branch 'main' of https://github.com/inkstitch/inkstitch into george-steel/fix-running-stitch
Diffstat (limited to 'lib/elements/satin_column.py')
-rw-r--r--lib/elements/satin_column.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/elements/satin_column.py b/lib/elements/satin_column.py
index e935a9d7..be614a04 100644
--- a/lib/elements/satin_column.py
+++ b/lib/elements/satin_column.py
@@ -361,7 +361,10 @@ class SatinColumn(EmbroideryElement):
@property
@cache
def csp(self):
- return self.parse_path()
+ paths = self.parse_path()
+ # exclude subpaths which are just a point
+ paths = [path for path in paths if len(path) >= 2]
+ return paths
@property
@cache
@@ -518,8 +521,9 @@ class SatinColumn(EmbroideryElement):
def validation_errors(self):
# The node should have exactly two paths with the same number of points - or it should
# have two rails and at least one rung
-
- if len(self.rails) < 2:
+ if len(self.csp) < 2:
+ yield TooFewPathsError((0, 0))
+ elif len(self.rails) < 2:
yield TooFewPathsError(self.shape.centroid)
elif len(self.csp) == 2:
if len(self.rails[0]) != len(self.rails[1]):
@@ -1015,7 +1019,7 @@ class SatinColumn(EmbroideryElement):
self.zigzag_spacing,
self.pull_compensation_px,
self.pull_compensation_percent/100,
- self.random_width_decrease.any() and self.random_width_increase.any() and self.random_zigzag_spacing,
+ self.random_width_decrease.any() or self.random_width_increase.any() or self.random_zigzag_spacing,
)
# "left" and "right" here are kind of arbitrary designations meaning
@@ -1070,7 +1074,7 @@ class SatinColumn(EmbroideryElement):
offset_px = [0, 0]
if a.distance(pairs[i-1][0]) < min_dist:
offset_px[0] = -inset_px
- if b.distance(pairs[i-1][0]) < min_dist:
+ if b.distance(pairs[i-1][1]) < min_dist:
offset_px[1] = -inset_px
shortened.append(self.offset_points(a, b, offset_px, (0, 0)))
return shortened