summaryrefslogtreecommitdiff
path: root/lib/stitches
diff options
context:
space:
mode:
Diffstat (limited to 'lib/stitches')
-rw-r--r--lib/stitches/auto_satin.py4
-rw-r--r--lib/stitches/fill.py3
-rw-r--r--lib/stitches/guided_fill.py2
-rw-r--r--lib/stitches/ripple_stitch.py2
4 files changed, 7 insertions, 4 deletions
diff --git a/lib/stitches/auto_satin.py b/lib/stitches/auto_satin.py
index 93bffd57..6d792b4e 100644
--- a/lib/stitches/auto_satin.py
+++ b/lib/stitches/auto_satin.py
@@ -81,6 +81,8 @@ class SatinSegment(object):
satin = satin.apply_transform()
+ _ensure_even_repeats(satin)
+
return satin
to_element = to_satin
@@ -507,7 +509,6 @@ def name_elements(new_elements, preserve_order):
for element in new_elements:
if isinstance(element, SatinColumn):
element.node.set("id", generate_unique_id(element.node, "autosatin"))
- _ensure_even_repeats(element)
else:
element.node.set("id", generate_unique_id(element.node, "autosatinrun"))
@@ -515,7 +516,6 @@ def name_elements(new_elements, preserve_order):
if isinstance(element, SatinColumn):
# L10N Label for a satin column created by Auto-Route Satin Columns and Lettering extensions
element.node.set(INKSCAPE_LABEL, _("AutoSatin %d") % index)
- _ensure_even_repeats(element)
else:
# L10N Label for running stitch (underpathing) created by Auto-Route Satin Columns amd Lettering extensions
element.node.set(INKSCAPE_LABEL, _("AutoSatin Running Stitch %d") % index)
diff --git a/lib/stitches/fill.py b/lib/stitches/fill.py
index 60a0cb7d..11c9259b 100644
--- a/lib/stitches/fill.py
+++ b/lib/stitches/fill.py
@@ -125,6 +125,9 @@ def intersect_region_with_grating(shape, angle, row_spacing, end_row_spacing=Non
end -= center.y
height = abs(end - start)
+ if height == 0:
+ # return early to avoid divide-by-zero later
+ return []
# print >> dbg, "grating:", start, end, height, row_spacing, end_row_spacing
diff --git a/lib/stitches/guided_fill.py b/lib/stitches/guided_fill.py
index 14c58b7a..a9906bfb 100644
--- a/lib/stitches/guided_fill.py
+++ b/lib/stitches/guided_fill.py
@@ -247,7 +247,7 @@ def intersect_region_with_grating_guideline(shape, line, row_spacing, num_stagge
debug.log_line_string(offset_line, f"offset {row}")
- stitched_line = apply_stitches(offset_line, max_stitch_length, num_staggers, row_spacing, row * direction)
+ stitched_line = apply_stitches(offset_line, max_stitch_length, num_staggers, row_spacing, row)
intersection = shape.intersection(stitched_line)
if shape_envelope.intersects(stitched_line):
diff --git a/lib/stitches/ripple_stitch.py b/lib/stitches/ripple_stitch.py
index 67362f12..6b7ce6ca 100644
--- a/lib/stitches/ripple_stitch.py
+++ b/lib/stitches/ripple_stitch.py
@@ -220,7 +220,7 @@ def _get_start_rotation(line):
def _generate_satin_guide_helper_lines(stroke, outline, guide_line):
spacing = guide_line.center_line.length / (stroke.get_line_count() - 1)
- rail_points = guide_line.plot_points_on_rails(spacing, 0)
+ rail_points = guide_line.plot_points_on_rails(spacing)
point0 = rail_points[0][0]
point1 = rail_points[1][0]