Skip to content

Instantly share code, notes, and snippets.

@edy555
Created September 17, 2012 12:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save edy555/3736930 to your computer and use it in GitHub Desktop.
Save edy555/3736930 to your computer and use it in GitHub Desktop.
convert g-code to acceptable format for sprinter or marlin.
#!/usr/bin/env ruby
lastcmd="G0"
while line = gets
print "#{lastcmd}" if /^\s/ =~ line
print line
if /G(\d+)/ =~ line then
case $1.to_i
when 0 .. 3
lastcmd=$&
end
end
end
@pablinhob
Copy link

Here is my functional version in python.
G0 and G1 Speeds are detailed in each line, and asuming default when isn`t defined yet

https://gist.github.com/pablinhob/5b4a28e6b459bf64f90c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment