Commit 3962c428 authored by leonmuller's avatar leonmuller

Added differentiation between smoothie and marlin laser power.

Added misc changes
parent 25268ea6
This Inkscape extension is derived from THLaser. It converts paths to gcode for laser cutting. Unlike THLaser, ShinyLaser allows you to set different feedrates for traversal and cut moves. The gcode output is intended to be run on a laser cutter running Smoothieware. About This Fork
---------------
10.14.14 by ajf (https://github.com/ajfoul)
Modified to output gcode that is compatible with K40 style laser cutter
running Marlin
(https://github.com/lansing-makers-network/buildlog-lasercutter-marlin).
I couldn't get the original version from LMN repo to work with LMN's Marlin as
it never set the laser intensity on the M3 command.
This works form me, but YMMV. Very limited testing. Never leave your laser
cutter unattended while it's powered/operating. Keep a fire extinguisher
close by, wear saftey goggles, and be afraid!
USE AT YOUR OWN RISK!
10.17.14 - A little more testing reveals that G02 (CW ARC) and G03 (CCW ARC)
moves are problematic. Not sure if it's the modifications in this fork, the
original THLaser, LMN's Marlin, Inkscape, or some combination that is causing
the issues.
Basically, you should consider this pre-alpha code. Examine the exported
Gcode and do test runs on cardboard/paper before trying to cut on valuable
stock.
Also: G28 at the end of the job doesn't seem to be working at the moment, at
least not when running the gcode on my machine.
10.19.14 - G02 and G03 really screw things up, so I've set the default
min_arc_radius to 500 to force all cut moves to be G01. That has it's own
issues. At this point I wouldn't recommend using the Gcode from this for any
real jobs.
26-Feb-2015 - Forked from user ajfoul to extend functionality of smoothie
laser power levels 0.0 to 1.0, generic Marlin power levels being 0 to 100 and to add in
raster image detection and export support.
THLaser Inkscape Plugin
-----------------------
This program is an Inkscape extension for exporting a set of paths as
gcode script.
This script is a fork of Gcodetools v1.2 written by Nick Drobchenko and
is released under the same license (GPL v2).
Installation
------------
Copy the files thlaser.py and thlaser.inx into your Inkscape extensions
folder. Fire up inkscape and you will find the plugin under Extensions ->
Export -> THLaser GCode Export.
Keyboard Shortcut
-----------------
You may find it handy to assign the extension to a keyboard shortcut.
Include something like the following line to your inkscape keys
preferences file (this will bind the plugin to Ctrl+\):
<bind key="backslash" modifiers="Ctrl" action="org.thinkhaus.filter.thlaser"
display="true"/>
You can find your keyboard preferences file:
* On Linux: ~/.config/inkscape/keys/default.xml
* Windows: %UserProfile%\Application Data\Inkscape\keys\default.xml
If that file doesn't exist, create it and include the following:
<?xml version="1.0"?>
<keys name="My Keys">
<bind key="backslash" modifiers="Ctrl" action="org.thinkhaus.filter.thlaser"
display="true"/>
</keys>
...@@ -19,12 +19,15 @@ ...@@ -19,12 +19,15 @@
<param name='tab' type="notebook"> <param name='tab' type="notebook">
<page name='tab' _gui-text='Help'> <page name='tab' _gui-text='Help'>
<_param name="fullhelp" type="description">ShinyLaser exports inkscape paths to Gcode compatible with Smoothieware laser module. <_param name="fullhelp" type="description">ShinyLaser exports Inkscape paths to Gcode compatible with Ramps+Marlin or Smoothieware laser mainboards.
</_param>
This extenstion is a fork of THLaser v1.30, by Peter Rogers at think|haus, which is itself a fork of Gcodetools v1.2 by Nick Drobchenko.</_param>
</page> </page>
<page name='tab' _gui-text='Advanced'> <page name='tab' _gui-text='Advanced'>
<param name="mainboard" type="enum" _gui-text="Mainboard: ">
<item value="ramps">Ramps 1.4</item>
<item value="smoothie">Smoothie</item>
</param>
<param name="biarc-tolerance" type='float' _gui-text='Biarc interpolation tolerance'>1</param> <param name="biarc-tolerance" type='float' _gui-text='Biarc interpolation tolerance'>1</param>
<_param name="help" type="description">Biarc interpolation tolerance is the maximum allowed distance between a path and it's approximation. If this value is exceeded, the path will be split into two segments.</_param> <_param name="help" type="description">Biarc interpolation tolerance is the maximum allowed distance between a path and it's approximation. If this value is exceeded, the path will be split into two segments.</_param>
<param name="biarc-max-split-depth" type="int" _gui-text="Maximum splitting depth">4</param> <param name="biarc-max-split-depth" type="int" _gui-text="Maximum splitting depth">4</param>
...@@ -38,10 +41,10 @@ This extenstion is a fork of THLaser v1.30, by Peter Rogers at think|haus, which ...@@ -38,10 +41,10 @@ This extenstion is a fork of THLaser v1.30, by Peter Rogers at think|haus, which
<param name="filename" type="string" _gui-text="File name: ">output.g</param> <param name="filename" type="string" _gui-text="File name: ">output.g</param>
<param name="directory" type="string" _gui-text="Directory: "></param> <param name="directory" type="string" _gui-text="Directory: "></param>
<_param name="help" type="description">(blank is your desktop)</_param> <_param name="help" type="description">(blank is your desktop)</_param>
<param name="feed" type="int" min="0" max="1000" _gui-text="Cut Feedrate:">60</param> <param name="feed" type="int" min="0" max="5000" _gui-text="Cut Feedrate:">5000</param>
<param name="Mfeed" type="int" min="0" max="5000" _gui-text="Traversal Feedrate:">300</param> <param name="Mfeed" type="int" min="0" max="5000" _gui-text="Traversal Feedrate:">1400</param>
<param name="laser" type="float" precision="2" min="0" max="1" _gui-text="Laser Intensity (0.0-1):">0.1</param> <param name="laser" type="int" min="0" max="100" _gui-text="Laser Intensity (0-100%):">10</param>
<param name="homebefore" type="boolean" _gui-text="HOMEALL (G28) Before:">true</param> <param name="homebefore" type="boolean" _gui-text="Home X & Y Before:">true</param>
<param name="homeafter" type="boolean" _gui-text="Home X & Y After:">false</param> <param name="homeafter" type="boolean" _gui-text="Home X & Y After:">false</param>
<param name="Xscale" type="float" precision="4" min="-1000" max="1000" _gui-text="Scale along X axis:">1</param> <param name="Xscale" type="float" precision="4" min="-1000" max="1000" _gui-text="Scale along X axis:">1</param>
......
...@@ -72,6 +72,9 @@ Changelog 2010-04-07 - Adina: ...@@ -72,6 +72,9 @@ Changelog 2010-04-07 - Adina:
Changelog 2010-04-20: Changelog 2010-04-20:
* made the .inx file refer to the correct .py file... it should work now? * made the .inx file refer to the correct .py file... it should work now?
Notes : M649 S100 L300 P10 - Laser 100 percent, pulses are each 300ms, and 10 pulses per mm.
""" """
### ###
...@@ -396,11 +399,11 @@ def parse_layer_name(txt): ...@@ -396,11 +399,11 @@ def parse_layer_name(txt):
(field, value) = arg.split("=") (field, value) = arg.split("=")
except: except:
raise ValueError("Invalid argument in layer '%s'" % layerName) raise ValueError("Invalid argument in layer '%s'" % layerName)
if (field == "feed"): if (field == "feed" or field == "ppm"):
try: try:
value = float(value) value = float(value)
except: except:
raise ValueError("Invalid feed rate '%s'" % value) raise ValueError("Invalid layer name '%s'" % value)
params[field] = value params[field] = value
logger.write("%s == %s" % (field, value)) logger.write("%s == %s" % (field, value))
...@@ -435,7 +438,7 @@ class Gcode_tools(inkex.Effect): ...@@ -435,7 +438,7 @@ class Gcode_tools(inkex.Effect):
# added move (laser off) feedrate and laser intensity; made all int rather than float - (ajf) # added move (laser off) feedrate and laser intensity; made all int rather than float - (ajf)
self.OptionParser.add_option("-p", "--feed", action="store", type="int", dest="feed", default="60", help="Cut Feed rate in unit/min") self.OptionParser.add_option("-p", "--feed", action="store", type="int", dest="feed", default="60", help="Cut Feed rate in unit/min")
self.OptionParser.add_option("-m", "--Mfeed", action="store", type="int", dest="Mfeed", default="300", help="Move Feed rate in unit/min") self.OptionParser.add_option("-m", "--Mfeed", action="store", type="int", dest="Mfeed", default="300", help="Move Feed rate in unit/min")
self.OptionParser.add_option("-l", "--laser", action="store", type="float", dest="laser", default="0.5", help="Laser intensity (0.0-1.0)") self.OptionParser.add_option("-l", "--laser", action="store", type="int", dest="laser", default="10", help="Laser intensity (0-100 %)")
self.OptionParser.add_option("-b", "--homebefore", action="store", type="inkbool", dest="homebefore", default=True, help="Home all beofre starting (G28)") self.OptionParser.add_option("-b", "--homebefore", action="store", type="inkbool", dest="homebefore", default=True, help="Home all beofre starting (G28)")
self.OptionParser.add_option("-a", "--homeafter", action="store", type="inkbool", dest="homeafter", default=False, help="Home X Y at end of job") self.OptionParser.add_option("-a", "--homeafter", action="store", type="inkbool", dest="homeafter", default=False, help="Home X Y at end of job")
...@@ -732,6 +735,12 @@ class Gcode_tools(inkex.Effect): ...@@ -732,6 +735,12 @@ class Gcode_tools(inkex.Effect):
layers = list(reversed(get_layers(self.document))) layers = list(reversed(get_layers(self.document)))
#Switch between smoothie power levels and ramps+marlin power levels
#ramps and marlin expect 0 to 100 while smoothie wants 0.0 to 1.0
if (self.options.mainboard == 'smoothie'):
self.options.laser = self.options.laser / 100
# Loop over the layers and objects # Loop over the layers and objects
gcode = "" gcode = ""
for layer in layers: for layer in layers:
...@@ -779,10 +788,10 @@ class Gcode_tools(inkex.Effect): ...@@ -779,10 +788,10 @@ class Gcode_tools(inkex.Effect):
if (len(layers) > 1): if (len(layers) > 1):
gcode += LASER_OFF+"\n" gcode += LASER_OFF+"\n"
size = 60 size = 60
gcode += "(%s)\n" % ("*"*size) gcode += ";(%s)\n" % ("*"*size)
gcode += ("(***** LAYER: %%-%ds *****)\n" % (size-19)) % (layerName) gcode += (";(***** LAYER: %%-%ds *****)\n" % (size-19)) % (layerName)
gcode += "(%s)\n" % ("*"*size) gcode += ";(%s)\n" % ("*"*size)
gcode += "(MSG,Starting layer '%s')\n\n" % layerName gcode += ";(MSG,Starting layer '%s')\n\n" % layerName
# Move the laser into the starting position (so that way it is positioned # Move the laser into the starting position (so that way it is positioned
# for testing the power level, if the user wants to change that). # for testing the power level, if the user wants to change that).
arg = curve[0] arg = curve[0]
...@@ -872,7 +881,7 @@ class Gcode_tools(inkex.Effect): ...@@ -872,7 +881,7 @@ class Gcode_tools(inkex.Effect):
gcode += self.effect_curve(selected) gcode += self.effect_curve(selected)
if (self.options.double_sided_cutting): if (self.options.double_sided_cutting):
gcode += "\n\n(MSG,Please flip over material)\n\n" gcode += "\n\n;(MSG,Please flip over material)\n\n"
# Include a tool change operation # Include a tool change operation
gcode += self.tool_change() gcode += self.tool_change()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment