diff options
| author | Kaalleen <36401965+kaalleen@users.noreply.github.com> | 2023-10-15 07:18:26 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-10-15 07:18:26 +0200 |
| commit | 1ff677722844e311f64d10079ff96b725b00676e (patch) | |
| tree | f49337585180c7afae0c66d6591702d2fbc7f56b /lib/stitch_plan | |
| parent | 45e430bb60e2a952211a3526fabb5e11badfcce3 (diff) | |
Add element info extension (#2544)
Diffstat (limited to 'lib/stitch_plan')
| -rw-r--r-- | lib/stitch_plan/color_block.py | 6 | ||||
| -rw-r--r-- | lib/stitch_plan/stitch_plan.py | 4 |
2 files changed, 10 insertions, 0 deletions
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 @@ -80,6 +80,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: return self.last_stitch.stop 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 @@ -173,6 +173,10 @@ class StitchPlan(object): 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] minx = min(bb[0] for bb in color_block_bounding_boxes) |
