Feedrate reformatting post script
-
I am looking for help with writing a post process script to adjust the formatting of the feedrate call outs from PrusaSlicer.
Right now the format is like this:
1 G1 E.1 F2400
2 ;TYPE:Skirt/Brim
3 ;WIDTH:1.7
4 G1 F4799.988
5 G1 X487.836 Y463.711 E.82895But this causes issues where my machine doesn't recognize the G1 F4799.988 command and maintains the feed rate of F2400 from line 1.
I need it to look something like this (which comes from Simplify3D, but I want to use organic tree supports).
6 G1 Z0.900 F1800
7 G1 X483.600 Y469.844 F21000
8 G1 X490.044 Y463.400 E4.6282 F3600
9 G1 X549.956 Y463.400 E35.0570Any help would be appreciated.
-
@justinkg it would be better to tell us what firmware you are running so the "bug" can be addressed rather than trying to fix the output.
Lots of people use prusaslicer.
A sample gcode file would also b e helpful -
The machine uses a yaskawa controller and apparently how it interprets the gcode is part of the firmware. No way for me to change anything in there. The slicer firmware is RepRap/Sprinter.
-
@justinkg oh, so nothing to do with RRF. You're just after general help. gotcha
-
-
Yeah. From what I can gather. I need to write a script to go through the entire gcode and automate moving the feedrate to the end of the following line. I am going to try to write it in python, but its been a while.
-
@justinkg
Just a guess as I have no experience with Yaskawa controllers.
However some CNC controllers accept a feed rate command on its own
So try changing
G1 F3600
to
F3600 -
I was able to write a script in python that does what I want. Posting it here for others to reference if needed.
import sys
import reflag = False
out = open('YOUR FILE NAME HERE'+'_adjusted'+'.gcode', 'w')
with open('YOUR FILE NAME HERE.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