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
49adc513
Commit
49adc513
authored
9 years ago
by
Thomas Oster
Browse files
Options
Downloads
Plain Diff
Merge pull request #33 from mrzl/export_gcode
Export gcode
parents
cbb65794
5a3f5bea
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/com/t_oster/liblasercut/LaserCutter.java
+7
-0
7 additions, 0 deletions
src/com/t_oster/liblasercut/LaserCutter.java
src/com/t_oster/liblasercut/drivers/GenericGcodeDriver.java
+47
-1
47 additions, 1 deletion
src/com/t_oster/liblasercut/drivers/GenericGcodeDriver.java
with
54 additions
and
1 deletion
src/com/t_oster/liblasercut/LaserCutter.java
+
7
−
0
View file @
49adc513
...
@@ -24,6 +24,8 @@ package com.t_oster.liblasercut;
...
@@ -24,6 +24,8 @@ 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.util.LinkedList
;
import
java.util.LinkedList
;
import
java.util.List
;
import
java.util.List
;
...
@@ -80,6 +82,11 @@ public abstract class LaserCutter implements Cloneable, Customizable {
...
@@ -80,6 +82,11 @@ 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
{
System
.
err
.
println
(
"Your driver does not implement saveJob(LaserJob job)"
);
throw
new
NotImplementedException
();
}
/**
/**
* If you lasercutter supports autofocus, override this method,
* If you lasercutter supports autofocus, override this method,
* to let programs like VisiCut know, that they don't need to focus.
* to let programs like VisiCut know, that they don't need to focus.
...
...
This diff is collapsed.
Click to expand it.
src/com/t_oster/liblasercut/drivers/GenericGcodeDriver.java
+
47
−
1
View file @
49adc513
...
@@ -23,19 +23,27 @@ import com.t_oster.liblasercut.platform.Util;
...
@@ -23,19 +23,27 @@ import com.t_oster.liblasercut.platform.Util;
import
java.io.BufferedReader
;
import
java.io.BufferedReader
;
import
java.io.ByteArrayOutputStream
;
import
java.io.ByteArrayOutputStream
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.File
;
import
java.io.InputStreamReader
;
import
java.io.InputStreamReader
;
import
java.io.PrintStream
;
import
java.io.PrintStream
;
import
java.io.UnsupportedEncodingException
;
import
java.io.UnsupportedEncodingException
;
import
java.lang.Exception
;
import
java.net.InetSocketAddress
;
import
java.net.InetSocketAddress
;
import
java.net.Socket
;
import
java.net.Socket
;
import
java.net.URI
;
import
java.net.URI
;
import
java.net.URISyntaxException
;
import
java.net.URISyntaxException
;
import
java.net.URL
;
import
java.net.URL
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
purejavacomm.*
;
import
purejavacomm.*
;
import
java.util.*
;
import
java.util.*
;
import
net.sf.corn.httpclient.HttpClient
;
import
net.sf.corn.httpclient.HttpClient
;
import
net.sf.corn.httpclient.HttpResponse
;
import
net.sf.corn.httpclient.HttpResponse
;
/**
/**
* This class implements a driver for a generic GRBL GCode Lasercutter.
* This class implements a driver for a generic GRBL GCode Lasercutter.
* It should contain all possible options and is inteded to be the superclass
* It should contain all possible options and is inteded to be the superclass
...
@@ -377,6 +385,7 @@ public class GenericGcodeDriver extends LaserCutter {
...
@@ -377,6 +385,7 @@ public class GenericGcodeDriver extends LaserCutter {
}
}
}
}
private
void
writeShutdownCode
()
throws
IOException
{
private
void
writeShutdownCode
()
throws
IOException
{
if
(
postJobGcode
!=
null
)
if
(
postJobGcode
!=
null
)
{
{
...
@@ -408,7 +417,7 @@ public class GenericGcodeDriver extends LaserCutter {
...
@@ -408,7 +417,7 @@ public class GenericGcodeDriver extends LaserCutter {
}
}
}
}
}
}
protected
void
http_upload
(
URI
url
,
String
data
,
String
filename
)
throws
IOException
protected
void
http_upload
(
URI
url
,
String
data
,
String
filename
)
throws
IOException
{
{
HttpClient
client
=
new
HttpClient
(
url
);
HttpClient
client
=
new
HttpClient
(
url
);
...
@@ -651,6 +660,43 @@ public class GenericGcodeDriver extends LaserCutter {
...
@@ -651,6 +660,43 @@ public class GenericGcodeDriver extends LaserCutter {
pl
.
taskChanged
(
this
,
"sent."
);
pl
.
taskChanged
(
this
,
"sent."
);
pl
.
progressChanged
(
this
,
100
);
pl
.
progressChanged
(
this
,
100
);
}
}
@Override
public
void
saveJob
(
java
.
io
.
PrintStream
fileOutputStream
,
LaserJob
job
)
throws
IllegalJobException
,
Exception
{
checkJob
(
job
);
this
.
out
=
fileOutputStream
;
boolean
wasSetWaitingForOk
=
isWaitForOKafterEachLine
();
setWaitForOKafterEachLine
(
false
);
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
();
this
.
out
.
flush
();
setWaitForOKafterEachLine
(
wasSetWaitingForOk
);
}
private
List
<
Double
>
resolutions
;
private
List
<
Double
>
resolutions
;
@Override
@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