Skip to content
Snippets Groups Projects
Commit 4121eaef authored by Thomas Oster's avatar Thomas Oster
Browse files

Export support for Smoothie and LAOS. Fixes #18

parent 49adc513
No related branches found
No related tags found
No related merge requests found
...@@ -24,7 +24,7 @@ package com.t_oster.liblasercut; ...@@ -24,7 +24,7 @@ package com.t_oster.liblasercut;
import com.t_oster.liblasercut.platform.Point; import com.t_oster.liblasercut.platform.Point;
import com.t_oster.liblasercut.platform.Util; import com.t_oster.liblasercut.platform.Util;
import sun.reflect.generics.reflectiveObjects.NotImplementedException; import java.io.PrintStream;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
...@@ -82,10 +82,10 @@ public abstract class LaserCutter implements Cloneable, Customizable { ...@@ -82,10 +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 sendJob(LaserJob job, ProgressListener pl, List<String> warnings) throws IllegalJobException, Exception;
public void saveJob(java.io.PrintStream fileOutputStream, LaserJob job) throws NotImplementedException, IllegalJobException, Exception { public void saveJob(PrintStream fileOutputStream, LaserJob job) throws UnsupportedOperationException, IllegalJobException, Exception {
System.err.println("Your driver does not implement saveJob(LaserJob job)"); System.err.println("Your driver does not implement saveJob(LaserJob job)");
throw new NotImplementedException(); throw new UnsupportedOperationException("Your driver does not implement saveJob(LaserJob job)");
} }
/** /**
* If you lasercutter supports autofocus, override this method, * If you lasercutter supports autofocus, override this method,
......
...@@ -671,8 +671,6 @@ public void saveJob(java.io.PrintStream fileOutputStream, LaserJob job) throws I ...@@ -671,8 +671,6 @@ public void saveJob(java.io.PrintStream fileOutputStream, LaserJob job) throws I
setWaitForOKafterEachLine( false ); setWaitForOKafterEachLine( false );
writeInitializationCode(); writeInitializationCode();
int i = 0;
int max = job.getParts().size();
for (JobPart p : job.getParts()) for (JobPart p : job.getParts())
{ {
if (p instanceof RasterPart) if (p instanceof RasterPart)
...@@ -683,13 +681,10 @@ public void saveJob(java.io.PrintStream fileOutputStream, LaserJob job) throws I ...@@ -683,13 +681,10 @@ public void saveJob(java.io.PrintStream fileOutputStream, LaserJob job) throws I
white.setProperty("power", 0.0f); white.setProperty("power", 0.0f);
p = convertRasterToVectorPart((RasterPart) p, black, white, p.getDPI(), false); p = convertRasterToVectorPart((RasterPart) p, black, white, p.getDPI(), false);
} }
if (p instanceof VectorPart) else if (p instanceof VectorPart)
{ {
//TODO: in direct mode use progress listener to indicate progress
//of individual job
writeVectorGCode((VectorPart) p, p.getDPI()); writeVectorGCode((VectorPart) p, p.getDPI());
} }
i++;
} }
writeShutdownCode(); writeShutdownCode();
this.out.flush(); this.out.flush();
......
...@@ -654,7 +654,10 @@ public class LaosCutter extends LaserCutter ...@@ -654,7 +654,10 @@ public class LaosCutter extends LaserCutter
protected void writeJobCode(LaserJob job, OutputStream out, ProgressListener pl) throws UnsupportedEncodingException, IOException protected void writeJobCode(LaserJob job, OutputStream out, ProgressListener pl) throws UnsupportedEncodingException, IOException
{ {
out.write(this.generateInitializationCode()); out.write(this.generateInitializationCode());
pl.progressChanged(this, 20); if (pl != null)
{
pl.progressChanged(this, 20);
}
out.write(this.generateBoundingBoxCode(job)); out.write(this.generateBoundingBoxCode(job));
int i = 0; int i = 0;
int max = job.getParts().size(); int max = job.getParts().size();
...@@ -673,12 +676,29 @@ public class LaosCutter extends LaserCutter ...@@ -673,12 +676,29 @@ public class LaosCutter extends LaserCutter
out.write(this.generateVectorGCode((VectorPart) p, p.getDPI())); out.write(this.generateVectorGCode((VectorPart) p, p.getDPI()));
} }
i++; i++;
pl.progressChanged(this, 20 + (int) (i*(double) 60/max)); if (pl != null)
{
pl.progressChanged(this, 20 + (int) (i*(double) 60/max));
}
} }
out.write(this.generateShutdownCode()); out.write(this.generateShutdownCode());
out.close(); out.close();
} }
@Override
public void saveJob(PrintStream fileOutputStream, LaserJob job) throws UnsupportedOperationException, IllegalJobException, Exception
{
currentFrequency = -1;
currentPower = -1;
currentSpeed = -1;
currentFocus = 0;
currentPurge = false;
currentVentilation = false;
checkJob(job);
job.applyStartPoint();
this.writeJobCode(job, fileOutputStream, null);
}
@Override @Override
public void sendJob(LaserJob job, ProgressListener pl, List<String> warnings) throws IllegalJobException, Exception public void sendJob(LaserJob job, ProgressListener pl, List<String> warnings) throws IllegalJobException, Exception
{ {
......
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