From f2f1fea0cb5d5fe122cc62a338b3b6513528f313 Mon Sep 17 00:00:00 2001 From: Kaalleen <36401965+kaalleen@users.noreply.github.com> Date: Sat, 28 Jan 2023 22:33:58 +0100 Subject: remove subpaths with only one node from satins (#2033) --- lib/elements/satin_column.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'lib/elements') diff --git a/lib/elements/satin_column.py b/lib/elements/satin_column.py index 0981e6c3..1841bba1 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]): -- cgit v1.2.3