Skip to content
Snippets Groups Projects
Commit 5a3f5bea authored by Marcel Schwittlick's avatar Marcel Schwittlick
Browse files

exportgcode: fixing some quirks, refactoring

parent f8cff987
No related branches found
No related tags found
No related merge requests found
......@@ -24,6 +24,8 @@ package com.t_oster.liblasercut;
import com.t_oster.liblasercut.platform.Point;
import com.t_oster.liblasercut.platform.Util;
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
import java.util.LinkedList;
import java.util.List;
......@@ -80,7 +82,10 @@ public abstract class LaserCutter implements Cloneable, Customizable {
*/
public abstract void sendJob(LaserJob job, ProgressListener pl, List<String> warnings) throws IllegalJobException, Exception;
public abstract void saveJob(LaserJob job) throws IllegalJobException, Exception;
public void saveJob(java.io.PrintStream fileOutputStream, LaserJob job) throws NotImplementedException, IllegalJobException, Exception {
System.err.println("Your driver does not implement saveJob(LaserJob job)");
throw new NotImplementedException();
}
/**
* If you lasercutter supports autofocus, override this method,
......
......@@ -27,6 +27,7 @@ import java.io.File;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.io.UnsupportedEncodingException;
import java.lang.Exception;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.net.URI;
......@@ -661,14 +662,12 @@ public class GenericGcodeDriver extends LaserCutter {
}
@Override
public void saveJob(LaserJob job) throws IllegalJobException, Exception {
public void saveJob(java.io.PrintStream fileOutputStream, LaserJob job) throws IllegalJobException, Exception {
checkJob(job);
String timestamp = new SimpleDateFormat( "yyyyMMddhhmmssSSS" ).format( new Date( ) );
String filename = "output_" + timestamp + ".gcode";
System.out.println("Creating file " + filename);
this.out = new PrintStream(new File(filename));
this.out = fileOutputStream;
boolean wasSetWaitingForOk = isWaitForOKafterEachLine();
setWaitForOKafterEachLine( false );
writeInitializationCode();
......@@ -695,7 +694,7 @@ public void saveJob(LaserJob job) throws IllegalJobException, Exception {
writeShutdownCode();
this.out.flush();
setWaitForOKafterEachLine(true);
setWaitForOKafterEachLine(wasSetWaitingForOk);
}
private List<Double> resolutions;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment