summaryrefslogtreecommitdiff
path: root/lib/elements
diff options
context:
space:
mode:
authorKaalleen <36401965+kaalleen@users.noreply.github.com>2024-02-21 22:48:33 +0100
committerGitHub <noreply@github.com>2024-02-21 22:48:33 +0100
commite87fe0cce7993488a661b48a62b96a3f399def1c (patch)
treeb4e209c6a38b48fbc7a480c241e8077a3c31c355 /lib/elements
parent9b3950137db88715ac55d1e9bebc9aea2db4e83e (diff)
Detect satins with two rungs (#2734)
1. select elements 2. troubleshoot
Diffstat (limited to 'lib/elements')
-rw-r--r--lib/elements/satin_column.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/elements/satin_column.py b/lib/elements/satin_column.py
index 3daf1085..54ae02d5 100644
--- a/lib/elements/satin_column.py
+++ b/lib/elements/satin_column.py
@@ -58,7 +58,15 @@ class DanglingRungWarning(ValidationWarning):
description = _("Satin column: A rung doesn't intersect both rails.") + " " + rung_message
-class UnequalPointsWarning(ValidationError):
+class TwoRungsWarning(ValidationWarning):
+ name = _("Satin has exactly two rungs")
+ description = _("Satin column: There are exactly two rungs. This may lead to false rail/rung detection.")
+ steps_to_solve = [
+ _("Add an other rung.")
+ ]
+
+
+class UnequalPointsWarning(ValidationWarning):
name = _("Unequal number of points")
description = _("Satin column: There are no rungs and rails have an unequal number of points.")
steps_to_solve = [
@@ -668,6 +676,8 @@ class SatinColumn(EmbroideryElement):
return sections
def validation_warnings(self):
+ if len(self.csp) == 4:
+ yield TwoRungsWarning(self.flattened_rails[0].interpolate(0.5, normalized=True))
if len(self.csp) == 2 and len(self.rails[0]) != len(self.rails[1]):
yield UnequalPointsWarning(self.flattened_rails[0].interpolate(0.5, normalized=True))
for rung in self.flattened_rungs: