diff options
| author | Kaalleen <36401965+kaalleen@users.noreply.github.com> | 2024-03-26 07:10:40 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-26 07:10:40 +0100 |
| commit | 8e70f3d2feaab8a14f775a5ef84002bdab9688f0 (patch) | |
| tree | f34d46ead8eb8d15317dc98de4113ccaf8acd0e9 /lib/stitch_plan/stitch_plan.py | |
| parent | ea394f6d3b7de3bc0818b6a9921f64e8bcbc4fbf (diff) | |
Add object based min stitch length (#2792)
* add object based min stitch length (overwrites global)
* add object based minimum jump stitch (overwrites global)
* rename patches to stitch_groups
Diffstat (limited to 'lib/stitch_plan/stitch_plan.py')
| -rw-r--r-- | lib/stitch_plan/stitch_plan.py | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/lib/stitch_plan/stitch_plan.py b/lib/stitch_plan/stitch_plan.py index 8067749a..f6e3f0de 100644 --- a/lib/stitch_plan/stitch_plan.py +++ b/lib/stitch_plan/stitch_plan.py @@ -59,13 +59,23 @@ def stitch_groups_to_stitch_plan(stitch_groups, collapse_len=None, min_stitch_le # 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 - previous_stitch_group.force_lock_stitches)): - 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_lock = False + if len(color_block) and not need_tie_in: + distance_to_previous_stitch = (stitch_group.stitches[0] - color_block.stitches[-1]).length() + if previous_stitch_group.force_lock_stitches: + add_lock = True + elif previous_stitch_group.min_jump_stitch_length: + # object based minimum jump stitch length overrides the global collapse_len setting + if distance_to_previous_stitch > previous_stitch_group.min_jump_stitch_length: + add_lock = True + elif distance_to_previous_stitch > collapse_len: + add_lock = True + + if add_lock: + lock_stitches = previous_stitch_group.get_lock_stitches("end", disable_ties) + need_tie_in = True + if lock_stitches: + color_block.add_stitches(stitches=lock_stitches) if need_tie_in is True: lock_stitches = stitch_group.get_lock_stitches("start", disable_ties) |
