summaryrefslogtreecommitdiff
path: root/lib/stitch_plan/stitch_plan.py
diff options
context:
space:
mode:
authorLex Neva <github.com@lexneva.name>2019-07-09 20:39:07 -0400
committerLex Neva <github.com@lexneva.name>2019-07-09 20:39:07 -0400
commitcff12ce18ff94a4d7b779b3c7063eb6b82afa526 (patch)
tree13f8883d2c61d6f2d7173d97cdb0cbc5755e1f21 /lib/stitch_plan/stitch_plan.py
parent0cd562a4fcfe7ddec45103cf417e14409e378bff (diff)
remove all empty color blocks
Diffstat (limited to 'lib/stitch_plan/stitch_plan.py')
-rw-r--r--lib/stitch_plan/stitch_plan.py16
1 files changed, 10 insertions, 6 deletions
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)