From 0cd562a4fcfe7ddec45103cf417e14409e378bff Mon Sep 17 00:00:00 2001 From: Momo Date: Sun, 7 Jul 2019 16:25:21 +0200 Subject: delete empty color block --- lib/stitch_plan/stitch_plan.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/stitch_plan') diff --git a/lib/stitch_plan/stitch_plan.py b/lib/stitch_plan/stitch_plan.py index 808fa626..0b12c2c5 100644 --- a/lib/stitch_plan/stitch_plan.py +++ b/lib/stitch_plan/stitch_plan.py @@ -72,6 +72,10 @@ class StitchPlan(object): self.color_blocks.append(color_block) return color_block + def delete_empty_color_block(self, color_block): + if len(color_block) == 0: + self.color_blocks.remove(color_block) + def add_color_block(self, color_block): self.color_blocks.append(color_block) -- cgit v1.2.3 From cff12ce18ff94a4d7b779b3c7063eb6b82afa526 Mon Sep 17 00:00:00 2001 From: Lex Neva Date: Tue, 9 Jul 2019 20:39:07 -0400 Subject: remove all empty color blocks --- lib/stitch_plan/stitch_plan.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'lib/stitch_plan') diff --git a/lib/stitch_plan/stitch_plan.py b/lib/stitch_plan/stitch_plan.py index 0b12c2c5..59c54e3d 100644 --- a/lib/stitch_plan/stitch_plan.py +++ b/lib/stitch_plan/stitch_plan.py @@ -1,8 +1,8 @@ -from .stitch import Stitch -from .ties import add_ties from ..svg import PIXELS_PER_MM -from ..utils.geometry import Point from ..threads import ThreadColor +from ..utils.geometry import Point +from .stitch import Stitch +from .ties import add_ties def patches_to_stitch_plan(patches, collapse_len=3.0 * PIXELS_PER_MM): @@ -72,9 +72,13 @@ class StitchPlan(object): self.color_blocks.append(color_block) return color_block - def delete_empty_color_block(self, color_block): - if len(color_block) == 0: - self.color_blocks.remove(color_block) + def delete_empty_color_blocks(self): + color_blocks = [] + for color_block in self.color_blocks: + if len(color_block) > 0: + color_blocks.append(color_block) + + self.color_block = color_blocks def add_color_block(self, color_block): self.color_blocks.append(color_block) -- cgit v1.2.3 From 7ce4387ff6f8d4302ff374921d0b93b7b491b9a5 Mon Sep 17 00:00:00 2001 From: Momo Date: Wed, 10 Jul 2019 08:08:39 +0200 Subject: trim >= 3 jumps --- lib/stitch_plan/stitch_plan.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/stitch_plan') diff --git a/lib/stitch_plan/stitch_plan.py b/lib/stitch_plan/stitch_plan.py index 59c54e3d..899c502f 100644 --- a/lib/stitch_plan/stitch_plan.py +++ b/lib/stitch_plan/stitch_plan.py @@ -78,7 +78,7 @@ class StitchPlan(object): if len(color_block) > 0: color_blocks.append(color_block) - self.color_block = color_blocks + self.color_blocks = color_blocks def add_color_block(self, color_block): self.color_blocks.append(color_block) -- cgit v1.2.3