From 1cc14f7ba686a3c00f99cab8afb2fb2844810a99 Mon Sep 17 00:00:00 2001 From: Kaalleen <36401965+kaalleen@users.noreply.github.com> Date: Sun, 9 Jun 2024 11:06:08 +0200 Subject: add warning for closed path satins (#2976) --- lib/elements/satin_column.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'lib/elements/satin_column.py') diff --git a/lib/elements/satin_column.py b/lib/elements/satin_column.py index a714ad38..c031f229 100644 --- a/lib/elements/satin_column.py +++ b/lib/elements/satin_column.py @@ -48,9 +48,13 @@ class NotStitchableError(ValidationError): rung_message = _("Each rung should intersect both rails once.") -class TooManyIntersectionsWarning(ValidationWarning): - name = _("Rungs intersects too many times") - description = _("Satin column: A rung intersects a rail more than once.") + " " + rung_message +class ClosedPathWarning(ValidationWarning): + name = _("Rail is a closed path") + description = _("Rail is a closed path without a definite starting and ending point.") + steps_to_solve = [ + _('* Select the node where you want the satin to start.'), + _('* Click on: Break path at selected nodes.') + ] class DanglingRungWarning(ValidationWarning): @@ -67,6 +71,11 @@ class NoRungWarning(ValidationWarning): ] +class TooManyIntersectionsWarning(ValidationWarning): + name = _("Rungs intersects too many times") + description = _("Satin column: A rung intersects a rail more than once.") + " " + rung_message + + class TwoRungsWarning(ValidationWarning): name = _("Satin has exactly two rungs") description = _("There are exactly two rungs. This may lead to false rail/rung detection.") @@ -738,6 +747,9 @@ class SatinColumn(EmbroideryElement): yield DanglingRungWarning(rung.interpolate(0.5, normalized=True)) elif not isinstance(intersection, shgeo.Point): yield TooManyIntersectionsWarning(rung.interpolate(0.5, normalized=True)) + paths = self.node.get_path() + if any([path.letter == 'Z' for path in paths]): + yield ClosedPathWarning(self.flattened_rails[0].coords[0]) def validation_errors(self): # The node should have exactly two paths with the same number of points - or it should -- cgit v1.2.3