From b6bde000fe675ed725d7d5dbd7db3f44fb33af0e Mon Sep 17 00:00:00 2001 From: Kaalleen <36401965+kaalleen@users.noreply.github.com> Date: Wed, 22 Jun 2022 15:22:34 +0200 Subject: Option to drop short stitches (#1693) --- lib/stitch_plan/stitch_plan.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib/stitch_plan/stitch_plan.py') diff --git a/lib/stitch_plan/stitch_plan.py b/lib/stitch_plan/stitch_plan.py index 4593781a..04d587c2 100644 --- a/lib/stitch_plan/stitch_plan.py +++ b/lib/stitch_plan/stitch_plan.py @@ -13,7 +13,7 @@ from .color_block import ColorBlock from .ties import add_ties -def stitch_groups_to_stitch_plan(stitch_groups, collapse_len=None, disable_ties=False): # noqa: C901 +def stitch_groups_to_stitch_plan(stitch_groups, collapse_len=None, min_stitch_len=0.1, disable_ties=False): # noqa: C901 """Convert a collection of StitchGroups to a StitchPlan. @@ -71,7 +71,7 @@ def stitch_groups_to_stitch_plan(stitch_groups, collapse_len=None, disable_ties= # last block ended in a stop, so now we have an empty block del stitch_plan.color_blocks[-1] - stitch_plan.filter_duplicate_stitches() + stitch_plan.filter_duplicate_stitches(min_stitch_len) if not disable_ties: stitch_plan.add_ties() @@ -101,9 +101,9 @@ class StitchPlan(object): def add_color_block(self, color_block): self.color_blocks.append(color_block) - def filter_duplicate_stitches(self): + def filter_duplicate_stitches(self, min_stitch_len): for color_block in self: - color_block.filter_duplicate_stitches() + color_block.filter_duplicate_stitches(min_stitch_len) def add_ties(self): # see ties.py -- cgit v1.2.3