diff options
Diffstat (limited to 'lib/elements')
| -rw-r--r-- | lib/elements/clone.py | 4 | ||||
| -rw-r--r-- | lib/elements/satin_column.py | 24 | ||||
| -rw-r--r-- | lib/elements/stroke.py | 3 |
3 files changed, 23 insertions, 8 deletions
diff --git a/lib/elements/clone.py b/lib/elements/clone.py index f430f9b3..f408917d 100644 --- a/lib/elements/clone.py +++ b/lib/elements/clone.py @@ -5,8 +5,6 @@ from math import atan, degrees -import inkex - from ..commands import is_command, is_command_symbol from ..i18n import _ from ..svg.path import get_node_transform @@ -128,7 +126,7 @@ class Clone(EmbroideryElement): return patches def get_clone_style(self, style_name, node, default=None): - style = inkex.styles.AttrFallbackStyle(node).get(style_name) or default + style = node.style[style_name] or default return style def center(self, source_node): diff --git a/lib/elements/satin_column.py b/lib/elements/satin_column.py index 497ee471..a30f16d4 100644 --- a/lib/elements/satin_column.py +++ b/lib/elements/satin_column.py @@ -6,17 +6,18 @@ from copy import deepcopy from itertools import chain -from inkex import paths from shapely import affinity as shaffinity from shapely import geometry as shgeo from shapely.ops import nearest_points -from .element import EmbroideryElement, param -from .validation import ValidationError, ValidationWarning +from inkex import paths + from ..i18n import _ from ..stitch_plan import StitchGroup from ..svg import line_strings_to_csp, point_lists_to_csp from ..utils import Point, cache, collapse_duplicate_point, cut +from .element import EmbroideryElement, param +from .validation import ValidationError, ValidationWarning class SatinHasFillError(ValidationError): @@ -51,6 +52,15 @@ class UnequalPointsError(ValidationError): ] +class NotStitchableError(ValidationError): + name = _("Not stitchable satin column") + description = _("A satin column consists out of two rails and one or more rungs. This satin column may have a different setup.") + steps_to_solve = [ + _('Make sure your satin column is not a combination of multiple satin columns.'), + _('Go to our website and read how a satin column should look like https://inkstitch.org/docs/stitches/satin-column/'), + ] + + rung_message = _("Each rung should intersect both rails once.") @@ -422,6 +432,9 @@ class SatinColumn(EmbroideryElement): if not intersection.is_empty and not isinstance(intersection, shgeo.Point): yield TooManyIntersectionsError(rung.interpolate(0.5, normalized=True)) + if not self.to_stitch_groups(): + yield NotStitchableError(self.shape.centroid) + def reverse(self): """Return a new SatinColumn like this one but in the opposite direction. @@ -859,7 +872,7 @@ class SatinColumn(EmbroideryElement): points.append(Point(split_point.x, split_point.y)) return [points, split_count] - def to_stitch_groups(self, last_patch): + def to_stitch_groups(self, last_patch=None): # Stitch a variable-width satin column, zig-zagging between two paths. # The algorithm will draw zigzags between each consecutive pair of @@ -884,4 +897,7 @@ class SatinColumn(EmbroideryElement): else: patch += self.do_satin() + if not patch.stitches: + return [] + return [patch] diff --git a/lib/elements/stroke.py b/lib/elements/stroke.py index 763167ad..307c78b8 100644 --- a/lib/elements/stroke.py +++ b/lib/elements/stroke.py @@ -77,7 +77,8 @@ class Stroke(EmbroideryElement): default="1", sort_index=1) def repeats(self): - return self.get_int_param("repeats", 1) + repeats = self.get_int_param("repeats", 1) + return max(1, repeats) @property def paths(self): |
