From 1ff677722844e311f64d10079ff96b725b00676e Mon Sep 17 00:00:00 2001 From: Kaalleen <36401965+kaalleen@users.noreply.github.com> Date: Sun, 15 Oct 2023 07:18:26 +0200 Subject: Add element info extension (#2544) --- lib/stitch_plan/color_block.py | 6 ++++++ lib/stitch_plan/stitch_plan.py | 4 ++++ 2 files changed, 10 insertions(+) (limited to 'lib/stitch_plan') diff --git a/lib/stitch_plan/color_block.py b/lib/stitch_plan/color_block.py index fdef5eb8..a0f9d43f 100644 --- a/lib/stitch_plan/color_block.py +++ b/lib/stitch_plan/color_block.py @@ -79,6 +79,12 @@ class ColorBlock(object): return sum(1 for stitch in self if stitch.trim) + @property + def num_jumps(self): + """Number of jumps in this color block.""" + + return sum(1 for stitch in self if stitch.jump) + @property def stop_after(self): if self.last_stitch is not None: diff --git a/lib/stitch_plan/stitch_plan.py b/lib/stitch_plan/stitch_plan.py index 68d52699..8067749a 100644 --- a/lib/stitch_plan/stitch_plan.py +++ b/lib/stitch_plan/stitch_plan.py @@ -172,6 +172,10 @@ class StitchPlan(object): def num_stitches(self): return sum(block.num_stitches for block in self) + @property + def num_jumps(self): + return sum(block.num_jumps for block in self) + @property def bounding_box(self): color_block_bounding_boxes = [cb.bounding_box for cb in self] -- cgit v1.2.3