Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Retract post process
#!/usr/bin/env ruby
#filepath = "/home/user/whatever.gcode"
#chmod +x this file
# ./thisfile.rb "/file/path.here" > "/new/file.path"
filepath = ARGV[0].to_s
puts filepath
IO.write(filepath, File.open(filepath) {|f| f.read.gsub(/G1 E-1.*\nG0/, "G1 E-1")})
previous_line = ""
File.foreach(filepath) do |line|
if line.match(/^G1 E-/)
puts line.gsub(/F\d\d\d\d/, "F3500")
else
puts line
end
previous_line = line
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.