diff --git a/src/Mod/Path/PathScripts/opensbp_pre.py b/src/Mod/Path/PathScripts/opensbp_pre.py index e9bca9816117..90404f58e9df 100644 --- a/src/Mod/Path/PathScripts/opensbp_pre.py +++ b/src/Mod/Path/PathScripts/opensbp_pre.py @@ -1,26 +1,25 @@ -#*************************************************************************** -#* (c) sliptonic (shopinthewoodsgmail.com) 2014 * -#* * -#* This file is part of the FreeCAD CAx development system. * -#* * -#* This program is free software; you can redistribute it and/or modify * -#* it under the terms of the GNU Lesser General Public License (LGPL) * -#* as published by the Free Software Foundation; either version 2 of * -#* the License, or (at your option) any later version. * -#* for detail see the LICENCE text file. * -#* * -#* FreeCAD is distributed in the hope that it will be useful, * -#* but WITHOUT ANY WARRANTY; without even the implied warranty of * -#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * -#* GNU Lesser General Public License for more details. * -#* * -#* You should have received a copy of the GNU Library General Public * -#* License along with FreeCAD; if not, write to the Free Software * -#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * -#* USA * -#* * -#***************************************************************************/ - +# *************************************************************************** +# * (c) sliptonic (shopinthewoodsgmail.com) 2014 * +# * * +# * This file is part of the FreeCAD CAx development system. * +# * * +# * This program is free software; you can redistribute it and/or modify * +# * it under the terms of the GNU Lesser General Public License (LGPL) * +# * as published by the Free Software Foundation; either version 2 of * +# * the License, or (at your option) any later version. * +# * for detail see the LICENCE text file. * +# * * +# * FreeCAD is distributed in the hope that it will be useful, * +# * but WITHOUT ANY WARRANTY; without even the implied warranty of * +# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +# * GNU Lesser General Public License for more details. * +# * * +# * You should have received a copy of the GNU Library General Public * +# * License along with FreeCAD; if not, write to the Free Software * +# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * +# * USA * +# * * +# ***************************************************************************/ ''' This is a preprocessor file for the Path workbench. Its aim is to @@ -84,7 +83,6 @@ def insert(filename,docname): def parse(inputstring): "parse(inputstring): returns a list of parsed output string" print "preprocessing..." - # split the input by line lines = inputstring.split("\n") return_output = [] @@ -95,6 +93,7 @@ def parse(inputstring): movecommand = ['G1', 'G0', 'G02', 'G03'] for l in lines: + print l # remove any leftover trailing and preceding spaces l = l.strip() if not l: @@ -142,7 +141,7 @@ def parse(inputstring): speed = lastfeedspeed["XY"] else: speed = lastfeedspeed[words[0][1]] - + last[words[0][1]] = words[1] output += s + words[0][1] + str(words[1]) + " F" + speed + "\n" @@ -171,11 +170,11 @@ def parse(inputstring): continue if words[0] in ["TR"]: #Setting spindle speed - if int(words[1]) < 0: + if float(words[1]) < 0: s = "M4 S" else: s = "M3 S" - s += str(abs(int(words[1]))) + s += str(abs(float(words[1]))) output += s + '\n' if words[0] in ["CG"]: #Gcode circle/arc