RE: Post Process Error Code 1
Here is the python script.
#! python3 import sys import re flag = False out = open('sys.argv[1]'+'_adjusted'+'.gcode', 'w') with open('sys.argv[1].gcode') as f: for r in f: if re.search('G1 F', r): feedrate = r[3:] flag = True print(r[:-1] + ' ' + feedrate) # get rid of new line elif flag: r = r[:-1] + ' ' + feedrate out.write(r) flag = False # Reset flag else: out.write(r) flag = False # Reset flag
RE: Post Process Error Code 1
out = open('sys.argv[1]'+'_adjusted'+'.gcode', 'w')
You are trying to open a file named "sys.argv[1]_adjusted.gcode". You probably meant sys.argv[1]+'_adjusted.gcode'
open('sys.argv[1].gcode')
Similar to above. You probably meant open(sys.argv[1])
And another issue. Your modification need to be put back in the sys.argv[1] file.
I would try making changes like
import os ... infile = sys.argv[1] outfile = infile + '.tmp' out = open(outfile, 'w') with open(infile) as f: .... os.rename(outfile, infile)
RE: Post Process Error Code 1
Thanks for the feedback. Feel stupid about missing the quotes. I did try it and still get the same error. Maybe I am missing something stupid again. It did process it successfully once i removed the quotes, but when I added your suggestion for using the os i got the same Error Code 1 again.
#! python3 import sys import re import os flag = False infile = sys.argv[1] outfile = infile + '.tmp' out = open(outfile, 'w') with open(infile) as f: for r in f: if re.search('G1 F', r): feedrate = r[3:] flag = True print(r[:-1] + ' ' + feedrate) # get rid of new line elif flag: r = r[:-1] + ' ' + feedrate out.write(r) flag = False # Reset flag else: out.write(r) flag = False # Reset flag os.rename(outfile, infile)
RE: Post Process Error Code 1
try something like this:
1. remove custom processing scripts.
2. generate gcode as normal, save it
3. run terminal and execute python + script and pass saved gcode file path as parameter - check what is the output of the script, because it looks like it does not work as standalone?
See my GitHub and printables.com for some 3d stuff that you may like.
RE: Post Process Error Code 1
I have done that and it works great. That is what I have been doing to get by for now. Just would be nice to have it integrated into the slicer so it's one less step I have to do.
RE: Post Process Error Code 1
Hello 😀
Did you ever find a solution?