Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
LibLaserCut
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Elektronikföreningen Admittansen
LibLaserCut
Commits
e5ad9fec
Commit
e5ad9fec
authored
9 years ago
by
Marcel Schwittlick
Browse files
Options
Downloads
Patches
Plain Diff
exportgcode: implements saveJob for GenericGcodeDriver by overriding the output printstream
parent
48563e00
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/com/t_oster/liblasercut/drivers/GenericGcodeDriver.java
+44
-0
44 additions, 0 deletions
src/com/t_oster/liblasercut/drivers/GenericGcodeDriver.java
with
44 additions
and
0 deletions
src/com/t_oster/liblasercut/drivers/GenericGcodeDriver.java
+
44
−
0
View file @
e5ad9fec
...
...
@@ -23,6 +23,7 @@ import com.t_oster.liblasercut.platform.Util;
import
java.io.BufferedReader
;
import
java.io.ByteArrayOutputStream
;
import
java.io.IOException
;
import
java.io.File
;
import
java.io.InputStreamReader
;
import
java.io.PrintStream
;
import
java.io.UnsupportedEncodingException
;
...
...
@@ -31,11 +32,17 @@ import java.net.Socket;
import
java.net.URI
;
import
java.net.URISyntaxException
;
import
java.net.URL
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
purejavacomm.*
;
import
java.util.*
;
import
net.sf.corn.httpclient.HttpClient
;
import
net.sf.corn.httpclient.HttpResponse
;
/**
* This class implements a driver for a generic GRBL GCode Lasercutter.
* It should contain all possible options and is inteded to be the superclass
...
...
@@ -377,6 +384,7 @@ public class GenericGcodeDriver extends LaserCutter {
}
}
private
void
writeShutdownCode
()
throws
IOException
{
if
(
postJobGcode
!=
null
)
{
...
...
@@ -651,6 +659,42 @@ public class GenericGcodeDriver extends LaserCutter {
pl
.
taskChanged
(
this
,
"sent."
);
pl
.
progressChanged
(
this
,
100
);
}
@Override
public
void
saveJob
(
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
);
//BufferedWriter writer = new BufferedWriter(new FileWriter(filename));
this
.
out
=
new
PrintStream
(
new
File
(
filename
));
writeInitializationCode
();
int
i
=
0
;
int
max
=
job
.
getParts
().
size
();
for
(
JobPart
p
:
job
.
getParts
())
{
if
(
p
instanceof
RasterPart
)
{
RasterPart
rp
=
(
RasterPart
)
p
;
LaserProperty
black
=
rp
.
getLaserProperty
();
LaserProperty
white
=
black
.
clone
();
white
.
setProperty
(
"power"
,
0.0f
);
p
=
convertRasterToVectorPart
((
RasterPart
)
p
,
black
,
white
,
p
.
getDPI
(),
false
);
}
if
(
p
instanceof
VectorPart
)
{
//TODO: in direct mode use progress listener to indicate progress
//of individual job
writeVectorGCode
((
VectorPart
)
p
,
p
.
getDPI
());
}
i
++;
}
writeShutdownCode
();
//writer.close();
}
private
List
<
Double
>
resolutions
;
@Override
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment