summaryrefslogtreecommitdiff
path: root/lib/stitch_plan/stitch_plan.py
diff options
context:
space:
mode:
authorLex Neva <github.com@lexneva.name>2018-05-28 20:06:26 -0400
committerLex Neva <github.com@lexneva.name>2018-05-28 20:06:26 -0400
commit77d6b78f92d507cdb22e744b1c93712fc6d67e5b (patch)
treef346b826a92285f27f4396b09727d53e517ddfe7 /lib/stitch_plan/stitch_plan.py
parentbf86eace9ada3beb6ba58f6f3d982da0e391bd7c (diff)
fix STOP handling
Apparently STOP codes (a.k.a. color changes) should be by themselves, not attached to another stitch. To add a STOP code at a given stitch, we should clone the stitch and then set the STOP command on the new stitch.
Diffstat (limited to 'lib/stitch_plan/stitch_plan.py')
-rw-r--r--lib/stitch_plan/stitch_plan.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/stitch_plan/stitch_plan.py b/lib/stitch_plan/stitch_plan.py
index 570a7645..fef7f61d 100644
--- a/lib/stitch_plan/stitch_plan.py
+++ b/lib/stitch_plan/stitch_plan.py
@@ -39,8 +39,12 @@ def patches_to_stitch_plan(patches, collapse_len=3.0 * PIXELS_PER_MM):
color_block.add_stitch(patch.stitches[0].x, patch.stitches[0].y, jump=True)
else:
- # add a color change
- color_block.add_stitch(color_block.last_stitch.x, color_block.last_stitch.y, stop=True)
+ # add a color change (only if the last stitch wasn't a "STOP after")
+ if not color_block.last_stitch.stop:
+ stitch = color_block.last_stitch.copy()
+ stitch.stop = True
+ color_block.add_stitch(stitch)
+
color_block = stitch_plan.new_color_block()
color_block.color = patch.color