-
Notifications
You must be signed in to change notification settings - Fork 1
/
GCodeFiler
29 lines (25 loc) · 1.18 KB
/
GCodeFiler
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/* Made for the University of Connecticut Institution of Material Science
GCodeFiler takes in a large text file of GCode and exports to code into seperate files to decrease manual labor.
For those who don't know, GCode is the code that controls the trackpath of 3D printers. The IMS produced a large text file
of all their test cube 3D models to test matrices that best promote cell growth. This text file needed to be seperated by
their individual test cubes into independent files.
*/
import java.util.*;
import java.io.*;
public class GCodeFiler {
public static void main(String[] args) throws FileNotFoundException{
Scanner console = new Scanner(System.in);
System.out.println("Filename:"); // reads main GCode file
String filename = console.next();
Scanner input = new Scanner(new File(filename));
while (input.hasNextLine()) { // prints file by line
String codeLine = (input.nextLine());
System.out.println(codeLine);
if (codeLine.contains("G92 E0")) { // outputs file when the code for the cube ends
System.out.println("Output Filename:");
String outputName = console.next();
PrintStream out = new PrintStream(new FileOutputStream(outputName));
}
}
}
}