summaryrefslogtreecommitdiff
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
parent32548e8e51d13d511813ba4e2a4571bd73e440e5 (diff)
parentb3637f261f9d248408ff3fbd92f9c676c3abe768 (diff)
add grbl laser options for g-code output (#450)
add grbl laser options for g-code output
-rw-r--r--lib/extensions/output.py2
-rw-r--r--lib/stitch_plan/stitch_plan.py16
m---------pyembroidery0
-rw-r--r--templates/output_params_txt.xml13
4 files changed, 18 insertions, 13 deletions
diff --git a/lib/extensions/output.py b/lib/extensions/output.py
index 8b99c027..ccf4d7cb 100644
--- a/lib/extensions/output.py
+++ b/lib/extensions/output.py
@@ -46,7 +46,7 @@ class Output(InkstitchExtension):
return
patches = self.elements_to_patches(self.elements)
- stitch_plan = patches_to_stitch_plan(patches)
+ stitch_plan = patches_to_stitch_plan(patches, disable_ties=self.settings.get('laser_mode', False))
temp_file = tempfile.NamedTemporaryFile(suffix=".%s" % self.file_extension, delete=False)
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
diff --git a/pyembroidery b/pyembroidery
-Subproject 47b795a084bdc3281fbf944b940609bf86193fd
+Subproject dc5b1abf871d5d0117bd7b7461f12a7a8af6338
diff --git a/templates/output_params_txt.xml b/templates/output_params_txt.xml
index 3b78df3b..451a6ca9 100644
--- a/templates/output_params_txt.xml
+++ b/templates/output_params_txt.xml
@@ -1,4 +1,11 @@
{# these parameters are for g-code files (*.txt) #}
- <param name="flip_x" type="boolean" gui-description="{{ _("Negate x coordinates") }}">false</param>
- <param name="flip_y" type="boolean" gui-description="{{ _("Negate y coordinates") }}">false</param>
- <param name="stitch_z_travel" type="float" gui-description="{{ _("increment z coordinate by this amount per stitch") }}">5.0</param>
+ <param name="laser_mode" type="boolean" gui-text="{{ _("laser mode") }}" gui-description="{{ _("Laser mode (generate g-code for grbl laser mode)") }}">false</param>
+ <param name="dynamic_laser_power" type="boolean" gui-text="{{ _("dynamic laser power") }}" gui-description="{{ _("Use Grbl's M4 dynamic laser power mode. Ensures consistent laser cutting power regardless of motor speed. Only for PWM-capable lasers.") }}" min="0.0" max="5.0">true</param>
+ <param name="laser_warm_up_time" type="float" gui-text="{{ _("laser warm-up time") }}" gui-description="{{ _("When turning on the laser, wait this many seconds for laser to warm up (G4 command)") }}">0.0</param>
+ <param name="flip_x" type="boolean" gui-text="{{ _("negate X coordinate values") }}" gui-description="{{ _("Negate x coordinates") }}">false</param>
+ <param name="flip_y" type="boolean" gui-text="{{ _("negate Y coordinate values") }}" gui-description="{{ _("Negate y coordinates") }}">false</param>
+ <param name="stitch_z_travel" type="float" gui-text="{{ _("Z travel per stitch") }}" gui-description="{{ _("increment z coordinate by this amount per stitch") }}">5.0</param>
+ <param name="spindle_speed" type="int" gui-text="{{ _("spindle speed") }}" gui-description="{{ _("spindle speed (laser power for laser mode, set to -1 to omit)") }}" min="-1" max="1000000000">-1</param>
+ <param name="min_spindle_speed" type="int" gui-text="{{ _("min spindle speed") }}" gui-description="{{ _("minimum spindle speed value (grbl $31 setting)") }}" min="-1" max="1000000000">-1</param>
+ <param name="max_spindle_speed" type="int" gui-text="{{ _("max spindle speed") }}" gui-description="{{ _("minimum spindle speed value (grbl $30 setting)") }}" min="-1" max="1000000000">-1</param>
+ <param name="feed_rate" type="int" gui-description="{{ _("feed rate (in mm/min, set to -1 to omit)")}}" min="-1" max="1000000000">-1</param> \ No newline at end of file