Created
September 17, 2012 12:02
-
-
Save edy555/3736930 to your computer and use it in GitHub Desktop.
convert g-code to acceptable format for sprinter or marlin.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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