(path string)
| 7 | ) |
| 8 | |
| 9 | func loadFile(path string) *gcode.File { |
| 10 | // open g-code file |
| 11 | file, err := os.Open(path) |
| 12 | if err != nil { |
| 13 | panic(err) |
| 14 | } |
| 15 | |
| 16 | // make sure file gets closed |
| 17 | defer file.Close() |
| 18 | |
| 19 | // parse file |
| 20 | f, err := gcode.ParseFile(file) |
| 21 | if err != nil { |
| 22 | panic(err) |
| 23 | } |
| 24 | |
| 25 | return f |
| 26 | } |
| 27 | |
| 28 | func writeFile(path string, f *gcode.File) { |
| 29 | // create g-code file |