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
a9b1640a
Commit
a9b1640a
authored
11 years ago
by
Thomas Oster
Browse files
Options
Downloads
Patches
Plain Diff
LAOS: Send bounding box. Should fix #15
parent
5860d23a
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/LaosCutter.java
+37
-1
37 additions, 1 deletion
src/com/t_oster/liblasercut/drivers/LaosCutter.java
with
37 additions
and
1 deletion
src/com/t_oster/liblasercut/drivers/LaosCutter.java
+
37
−
1
View file @
a9b1640a
...
@@ -633,7 +633,7 @@ public class LaosCutter extends LaserCutter
...
@@ -633,7 +633,7 @@ public class LaosCutter extends LaserCutter
}
}
return
result
.
toByteArray
();
return
result
.
toByteArray
();
}
}
private
byte
[]
generateInitializationCode
()
throws
UnsupportedEncodingException
private
byte
[]
generateInitializationCode
()
throws
UnsupportedEncodingException
{
{
ByteArrayOutputStream
result
=
new
ByteArrayOutputStream
();
ByteArrayOutputStream
result
=
new
ByteArrayOutputStream
();
...
@@ -655,6 +655,7 @@ public class LaosCutter extends LaserCutter
...
@@ -655,6 +655,7 @@ public class LaosCutter extends LaserCutter
{
{
out
.
write
(
this
.
generateInitializationCode
());
out
.
write
(
this
.
generateInitializationCode
());
pl
.
progressChanged
(
this
,
20
);
pl
.
progressChanged
(
this
,
20
);
out
.
write
(
this
.
generateBoundingBoxCode
(
job
));
int
i
=
0
;
int
i
=
0
;
int
max
=
job
.
getParts
().
size
();
int
max
=
job
.
getParts
().
size
();
for
(
JobPart
p
:
job
.
getParts
())
for
(
JobPart
p
:
job
.
getParts
())
...
@@ -964,4 +965,39 @@ public class LaosCutter extends LaserCutter
...
@@ -964,4 +965,39 @@ public class LaosCutter extends LaserCutter
return
clone
;
return
clone
;
}
}
/**
* Calculates the smallest bounding box of all job-parts
* and generates the laos bounding-box commands
* @param job
* @return
* @throws UnsupportedEncodingException
*/
private
byte
[]
generateBoundingBoxCode
(
LaserJob
job
)
throws
UnsupportedEncodingException
{
ByteArrayOutputStream
result
=
new
ByteArrayOutputStream
();
PrintStream
out
=
new
PrintStream
(
result
,
true
,
"US-ASCII"
);
if
(
job
.
getParts
().
size
()
>
0
)
{
JobPart
p
=
job
.
getParts
().
get
(
0
);
double
xMin
=
Util
.
px2mm
(
p
.
getMinX
(),
p
.
getDPI
());
double
xMax
=
Util
.
px2mm
(
p
.
getMaxX
(),
p
.
getDPI
());
double
yMin
=
Util
.
px2mm
(
p
.
getMinY
(),
p
.
getDPI
());
double
yMax
=
Util
.
px2mm
(
p
.
getMaxY
(),
p
.
getDPI
());
double
maxDPI
=
p
.
getDPI
();
for
(
JobPart
jp
:
job
.
getParts
())
{
xMin
=
Math
.
min
(
xMin
,
Util
.
px2mm
(
jp
.
getMinX
(),
jp
.
getDPI
()));
xMax
=
Math
.
max
(
xMax
,
Util
.
px2mm
(
jp
.
getMaxX
(),
jp
.
getDPI
()));
yMin
=
Math
.
min
(
yMin
,
Util
.
px2mm
(
jp
.
getMinY
(),
jp
.
getDPI
()));
yMax
=
Math
.
max
(
yMax
,
Util
.
px2mm
(
jp
.
getMaxY
(),
jp
.
getDPI
()));
maxDPI
=
Math
.
max
(
maxDPI
,
jp
.
getDPI
());
}
out
.
printf
(
"201 %d %d\n"
,
px2steps
(
Util
.
mm2px
(
isFlipXaxis
()
?
bedWidth
-
xMax
:
xMin
,
maxDPI
),
maxDPI
));
out
.
printf
(
"202 %d %d\n"
,
px2steps
(
Util
.
mm2px
(
isFlipXaxis
()
?
bedWidth
-
xMin
:
xMax
,
maxDPI
),
maxDPI
));
out
.
printf
(
"203 %d %d\n"
,
px2steps
(
Util
.
mm2px
(
isFlipYaxis
()
?
bedWidth
-
yMax
:
yMin
,
maxDPI
),
maxDPI
));
out
.
printf
(
"204 %d %d\n"
,
px2steps
(
Util
.
mm2px
(
isFlipYaxis
()
?
bedWidth
-
xMin
:
yMax
,
maxDPI
),
maxDPI
));
}
return
result
.
toByteArray
();
}
}
}
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