opensbp preprocessor handles float for spindle speed
This commit is contained in:
parent
fd57f47e3d
commit
ee5bb83a38
|
@ -21,7 +21,6 @@
|
||||||
# * *
|
# * *
|
||||||
# ***************************************************************************/
|
# ***************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
'''
|
'''
|
||||||
This is a preprocessor file for the Path workbench. Its aim is to
|
This is a preprocessor file for the Path workbench. Its aim is to
|
||||||
parse the contents of a given OpenSBP file, and transform it to make it
|
parse the contents of a given OpenSBP file, and transform it to make it
|
||||||
|
@ -84,7 +83,6 @@ def insert(filename,docname):
|
||||||
def parse(inputstring):
|
def parse(inputstring):
|
||||||
"parse(inputstring): returns a list of parsed output string"
|
"parse(inputstring): returns a list of parsed output string"
|
||||||
print "preprocessing..."
|
print "preprocessing..."
|
||||||
|
|
||||||
# split the input by line
|
# split the input by line
|
||||||
lines = inputstring.split("\n")
|
lines = inputstring.split("\n")
|
||||||
return_output = []
|
return_output = []
|
||||||
|
@ -95,6 +93,7 @@ def parse(inputstring):
|
||||||
movecommand = ['G1', 'G0', 'G02', 'G03']
|
movecommand = ['G1', 'G0', 'G02', 'G03']
|
||||||
|
|
||||||
for l in lines:
|
for l in lines:
|
||||||
|
print l
|
||||||
# remove any leftover trailing and preceding spaces
|
# remove any leftover trailing and preceding spaces
|
||||||
l = l.strip()
|
l = l.strip()
|
||||||
if not l:
|
if not l:
|
||||||
|
@ -171,11 +170,11 @@ def parse(inputstring):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if words[0] in ["TR"]: #Setting spindle speed
|
if words[0] in ["TR"]: #Setting spindle speed
|
||||||
if int(words[1]) < 0:
|
if float(words[1]) < 0:
|
||||||
s = "M4 S"
|
s = "M4 S"
|
||||||
else:
|
else:
|
||||||
s = "M3 S"
|
s = "M3 S"
|
||||||
s += str(abs(int(words[1])))
|
s += str(abs(float(words[1])))
|
||||||
output += s + '\n'
|
output += s + '\n'
|
||||||
|
|
||||||
if words[0] in ["CG"]: #Gcode circle/arc
|
if words[0] in ["CG"]: #Gcode circle/arc
|
||||||
|
|
Loading…
Reference in New Issue
Block a user