summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorKaalleen <36401965+kaalleen@users.noreply.github.com>2024-06-09 11:06:08 +0200
committerGitHub <noreply@github.com>2024-06-09 11:06:08 +0200
commit1cc14f7ba686a3c00f99cab8afb2fb2844810a99 (patch)
tree420d0e957df4f1c1158565bf1d14f386126d8366 /lib
parent9462a05d443bdf85d4bc4fb1bf9a79314c4b31df (diff)
add warning for closed path satins (#2976)
Diffstat (limited to 'lib')
-rw-r--r--lib/elements/satin_column.py18
1 files changed, 15 insertions, 3 deletions
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