diff options
| author | J. D. Bartlett <josh@bartletts.id.au> | 2023-03-14 11:44:24 +1000 |
|---|---|---|
| committer | J. D. Bartlett <josh@bartletts.id.au> | 2023-03-14 11:44:24 +1000 |
| commit | e5ce4499f602588e771d6d97840f304a2a95d2cd (patch) | |
| tree | d3adad69f95a61682cb3aa51aa11bc91b11fdab0 /lib/stitch_plan | |
| parent | aca54673afa8ac9e00f73fc5dc8d497c36f6f1ff (diff) | |
stitch_plan: we cannot create a new colour group on STOP, or colours will not match their colour groups
Diffstat (limited to 'lib/stitch_plan')
| -rw-r--r-- | lib/stitch_plan/stitch_plan.py | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/lib/stitch_plan/stitch_plan.py b/lib/stitch_plan/stitch_plan.py index 1a846099..0038a106 100644 --- a/lib/stitch_plan/stitch_plan.py +++ b/lib/stitch_plan/stitch_plan.py @@ -44,25 +44,17 @@ def stitch_groups_to_stitch_plan(stitch_groups, collapse_len=None, min_stitch_le continue if color_block.color != stitch_group.color: - if len(color_block) == 0: - # We just processed a stop, which created a new color block. - # end the previous block with a color change - stitch_plan.color_blocks[-2].add_stitch(color_change=True) - - # We'll just claim this new block as ours: - color_block.color = stitch_group.color - else: - # add a lock stitch to the last element of the previous group - lock_stitches = previous_stitch_group.get_lock_stitches("end", disable_ties) - if lock_stitches: - color_block.add_stitches(stitches=lock_stitches) - need_tie_in = True + # add a lock stitch to the last element of the previous group + lock_stitches = previous_stitch_group.get_lock_stitches("end", disable_ties) + if lock_stitches: + color_block.add_stitches(stitches=lock_stitches) + need_tie_in = True - # end the previous block with a color change - color_block.add_stitch(color_change=True) + # end the previous block with a color change + color_block.add_stitch(color_change=True) - # make a new block of our color - color_block = stitch_plan.new_color_block(color=stitch_group.color) + # make a new block of our color + color_block = stitch_plan.new_color_block(color=stitch_group.color) else: if (len(color_block) and not need_tie_in and ((stitch_group.stitches[0] - color_block.stitches[-1]).length() > collapse_len or @@ -94,7 +86,6 @@ def stitch_groups_to_stitch_plan(stitch_groups, collapse_len=None, min_stitch_le if stitch_group.stop_after: color_block.add_stitch(stop=True) - color_block = stitch_plan.new_color_block(color_block.color) previous_stitch_group = stitch_group |
