Skip to content

Commit

Permalink
opensbp preprocessor handles float for spindle speed
Browse files Browse the repository at this point in the history
  • Loading branch information
sliptonic authored and yorikvanhavre committed Jul 4, 2016
1 parent fd57f47 commit ee5bb83
Showing 1 changed file with 26 additions and 27 deletions.
53 changes: 26 additions & 27 deletions src/Mod/Path/PathScripts/opensbp_pre.py
@@ -1,26 +1,25 @@
#***************************************************************************
#* (c) sliptonic (shopinthewoods<at>gmail.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 (shopinthewoods<at>gmail.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
Expand Down Expand Up @@ -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 = []
Expand All @@ -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:
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit ee5bb83

Please sign in to comment.