From e87fe0cce7993488a661b48a62b96a3f399def1c Mon Sep 17 00:00:00 2001 From: Kaalleen <36401965+kaalleen@users.noreply.github.com> Date: Wed, 21 Feb 2024 22:48:33 +0100 Subject: Detect satins with two rungs (#2734) 1. select elements 2. troubleshoot --- lib/elements/satin_column.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'lib/elements/satin_column.py') 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: -- cgit v1.2.3