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
57565d51
Commit
57565d51
authored
11 years ago
by
Thomas Oster
Browse files
Options
Downloads
Patches
Plain Diff
Width+Height variable. Also properties to one map
parent
dbda003b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/com/t_oster/liblasercut/drivers/IModelaMill.java
+29
-25
29 additions, 25 deletions
src/com/t_oster/liblasercut/drivers/IModelaMill.java
with
29 additions
and
25 deletions
src/com/t_oster/liblasercut/drivers/IModelaMill.java
+
29
−
25
View file @
57565d51
...
...
@@ -38,8 +38,10 @@ import java.net.Socket;
import
java.net.URI
;
import
java.net.URISyntaxException
;
import
java.util.Arrays
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.util.Locale
;
import
java.util.Map
;
/**
*
...
...
@@ -65,9 +67,17 @@ public class IModelaMill extends LaserCutter
private
static
String
HOSTNAME
=
"Hostname/IP"
;
private
static
String
PORT
=
"port"
;
private
String
hostname
=
"localhost"
;
private
int
port
=
5000
;
private
static
String
BED_WIDTH
=
"bed width"
;
private
static
String
BED_HEIGHT
=
"bed height"
;
private
Map
<
String
,
Object
>
properties
=
new
LinkedHashMap
<
String
,
Object
>();
public
IModelaMill
()
{
properties
.
put
(
BED_WIDTH
,
(
Double
)
85
d
);
properties
.
put
(
BED_HEIGHT
,
(
Double
)
55
d
);
properties
.
put
(
HOSTNAME
,
"file:///dev/usb/lp0"
);
properties
.
put
(
PORT
,
(
Integer
)
5000
);
}
private
void
writeInitializationCode
(
PrintStream
out
)
{
...
...
@@ -207,19 +217,27 @@ public class IModelaMill extends LaserCutter
{
// software resolution in NC-Code mode: 0.001mm/step = 0.000036 inches/step
// means 1000 steps per mm
return
Arrays
.
asList
(
new
Double
[]{
Util
.
dpmm2dpi
(
1000
d
)});
return
Arrays
.
asList
(
new
Double
[]{
100
d
,
200
d
,
300
d
,
400
d
,
500
d
,
1000
d
,
1200
d
,
Util
.
dpmm2dpi
(
1000
d
)});
}
@Override
public
double
getBedWidth
()
{
return
86
;
if
(
properties
.
get
(
BED_WIDTH
)
==
null
)
{
properties
.
put
(
BED_WIDTH
,
(
Double
)
85
d
);
}
return
(
Double
)
properties
.
get
(
BED_WIDTH
);
}
@Override
public
double
getBedHeight
()
{
return
55
;
if
(
properties
.
get
(
BED_HEIGHT
)
==
null
)
{
properties
.
put
(
BED_HEIGHT
,
(
Double
)
55
d
);
}
return
(
Double
)
properties
.
get
(
BED_HEIGHT
);
}
@Override
...
...
@@ -242,38 +260,24 @@ public class IModelaMill extends LaserCutter
@Override
public
String
[]
getPropertyKeys
()
{
return
new
String
[]{
HOSTNAME
,
PORT
}
;
return
properties
.
keySet
().
toArray
(
new
String
[
0
])
;
}
@Override
public
void
setProperty
(
String
key
,
Object
value
)
{
if
(
HOSTNAME
.
equals
(
key
))
{
hostname
=
(
String
)
value
;
}
else
if
(
PORT
.
equals
(
key
))
{
port
=
(
Integer
)
value
;
}
properties
.
put
(
key
,
value
);
}
@Override
public
Object
getProperty
(
String
key
)
{
if
(
HOSTNAME
.
equals
(
key
))
{
return
hostname
;
}
else
if
(
PORT
.
equals
(
key
))
{
return
(
Integer
)
port
;
}
return
null
;
return
properties
.
get
(
key
);
}
private
void
sendGCode
(
byte
[]
gcode
,
ProgressListener
pl
,
List
<
String
>
warnings
)
throws
IOException
,
URISyntaxException
{
String
hostname
=
(
String
)
properties
.
get
(
HOSTNAME
);
pl
.
taskChanged
(
this
,
"connecting..."
);
if
(
"stdout"
.
equals
(
hostname
))
{
...
...
@@ -311,7 +315,7 @@ public class IModelaMill extends LaserCutter
else
{
Socket
s
=
new
Socket
();
s
.
connect
(
new
InetSocketAddress
(
hostname
,
port
),
3000
);
s
.
connect
(
new
InetSocketAddress
(
hostname
,
(
Integer
)
properties
.
get
(
PORT
)
),
3000
);
pl
.
taskChanged
(
this
,
"sending..."
);
s
.
getOutputStream
().
write
(
gcode
);
s
.
close
();
...
...
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