summaryrefslogtreecommitdiff
path: root/lib/stitch_plan/stitch_plan.py
diff options
context:
space:
mode:
authorLex Neva <lexelby@users.noreply.github.com>2019-07-27 15:45:12 -0400
committerGitHub <noreply@github.com>2019-07-27 15:45:12 -0400
commit03af8b37276870efd97f7049ced006f6e01ef935 (patch)
tree8a0aab903f19af1e01fdef6570df1ffe021ddf95 /lib/stitch_plan/stitch_plan.py
parent32548e8e51d13d511813ba4e2a4571bd73e440e5 (diff)
parentb3637f261f9d248408ff3fbd92f9c676c3abe768 (diff)
add grbl laser options for g-code output (#450)
add grbl laser options for g-code output
Diffstat (limited to 'lib/stitch_plan/stitch_plan.py')
-rw-r--r--lib/stitch_plan/stitch_plan.py16
1 files changed, 7 insertions, 9 deletions
diff --git a/lib/stitch_plan/stitch_plan.py b/lib/stitch_plan/stitch_plan.py
index 808fa626..8e84db4d 100644
--- a/lib/stitch_plan/stitch_plan.py
+++ b/lib/stitch_plan/stitch_plan.py
@@ -1,11 +1,11 @@
-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):
+def patches_to_stitch_plan(patches, collapse_len=3.0 * PIXELS_PER_MM, disable_ties=False):
"""Convert a collection of inkstitch.element.Patch objects to a StitchPlan.
* applies instructions embedded in the Patch such as trim_after and stop_after
@@ -14,10 +14,6 @@ def patches_to_stitch_plan(patches, collapse_len=3.0 * PIXELS_PER_MM):
"""
stitch_plan = StitchPlan()
-
- if not patches:
- return stitch_plan
-
color_block = stitch_plan.new_color_block(color=patches[0].color)
for patch in patches:
@@ -56,7 +52,9 @@ def patches_to_stitch_plan(patches, collapse_len=3.0 * PIXELS_PER_MM):
del stitch_plan.color_blocks[-1]
stitch_plan.filter_duplicate_stitches()
- stitch_plan.add_ties()
+
+ if not disable_ties:
+ stitch_plan.add_ties()
return stitch_plan