Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Amanda Ghassaei
DMDesign
Commits
0349a2ef
Commit
0349a2ef
authored
Aug 21, 2015
by
Amanda Ghassaei
Browse files
rapid commands
parent
ac787769
Changes
1
Hide whitespace changes
Inline
Side-by-side
js/cam/processes/GCodeExporter.js
View file @
0349a2ef
...
...
@@ -50,13 +50,13 @@ define(['underscore', 'cam', 'lattice', 'three'], function(_, cam, lattice, THRE
GCodeExporter
.
prototype
.
rapidXY
=
function
(
position
,
settings
){
var
data
=
""
;
if
(
this
.
postSpeed
!=
settings
.
rapidSpeeds
.
x
)
data
+=
this
.
_setSpeed
(
settings
.
rapidSpeeds
.
x
);
return
data
+
this
.
_
go
XYZ
(
position
.
x
,
position
.
y
,
null
);
return
data
+
this
.
_
rapid
XYZ
(
position
.
x
,
position
.
y
,
null
);
};
GCodeExporter
.
prototype
.
rapidZ
=
function
(
z
,
settings
){
var
data
=
""
;
if
(
this
.
postSpeed
!=
settings
.
rapidSpeeds
.
z
)
data
+=
this
.
_setSpeed
(
settings
.
rapidSpeeds
.
z
);
return
data
+
this
.
_
go
XYZ
(
null
,
null
,
z
);
return
data
+
this
.
_
rapid
XYZ
(
null
,
null
,
z
);
};
GCodeExporter
.
prototype
.
moveXY
=
function
(
x
,
y
,
settings
){
...
...
@@ -71,7 +71,7 @@ define(['underscore', 'cam', 'lattice', 'three'], function(_, cam, lattice, THRE
return
data
+
this
.
_goXYZ
(
null
,
null
,
z
);
};
GCodeExporter
.
prototype
.
_goXYZ
=
function
(
x
,
y
,
z
){
GCodeExporter
.
prototype
.
_goXYZ
=
function
(
x
,
y
,
z
,
command
){
if
(
x
!==
null
)
{
x
=
"
X
"
+
parseFloat
(
x
).
toFixed
(
3
);
this
.
postPosition
.
x
=
x
;
...
...
@@ -84,9 +84,14 @@ define(['underscore', 'cam', 'lattice', 'three'], function(_, cam, lattice, THRE
z
=
"
Z
"
+
parseFloat
(
z
).
toFixed
(
3
);
this
.
postPosition
.
z
=
z
;
}
if
(
command
)
return
this
.
addLine
(
command
,
[
x
,
y
,
z
]);
return
this
.
addLine
(
"
G01
"
,
[
x
,
y
,
z
]);
};
GCodeExporter
.
prototype
.
_rapidXYZ
=
function
(
x
,
y
,
z
){
return
this
.
_goXYZ
(
x
,
y
,
z
,
"
G0
"
);
};
GCodeExporter
.
prototype
.
goHome
=
function
(
settings
){
var
data
=
this
.
rapidZ
(
settings
.
rapidHeight
,
settings
);
return
data
+
this
.
rapidXY
({
x
:
0
,
y
:
0
},
settings
);
...
...
@@ -124,18 +129,22 @@ define(['underscore', 'cam', 'lattice', 'three'], function(_, cam, lattice, THRE
this
.
animationSpeed
=
line
.
split
(
"
F
"
)[
1
]
/
settings
.
scale
;
return
callback
();
}
if
(
line
==
""
||
line
[
0
]
==
"
(
"
||
line
.
substr
(
0
,
3
)
!=
"
G01
"
){
if
(
line
==
""
||
line
[
0
]
==
"
(
"
||
!
this
.
_isMoveCommand
(
line
)
){
return
callback
();
}
if
(
line
.
substr
(
0
,
3
)
==
"
G01
"
){
return
this
.
_simulate
G01
(
line
,
this
.
animationSpeed
,
machine
,
settings
,
callback
);
if
(
this
.
_isMoveCommand
(
line
)
){
return
this
.
_simulate
Move
(
line
,
this
.
animationSpeed
,
machine
,
settings
,
callback
);
}
else
{
console
.
warn
(
"
problem parsing gcode:
"
+
line
);
return
callback
();
}
};
GCodeExporter
.
prototype
.
_simulateG01
=
function
(
line
,
speed
,
machine
,
settings
,
callback
){
GCodeExporter
.
prototype
.
_isMoveCommand
=
function
(
line
){
return
line
.
substr
(
0
,
3
)
==
"
G01
"
||
line
.
substr
(
0
,
2
)
==
"
G0
"
;
};
GCodeExporter
.
prototype
.
_simulateMove
=
function
(
line
,
speed
,
machine
,
settings
,
callback
){
var
data
=
line
.
split
(
"
"
);
var
position
=
{
x
:
null
,
y
:
null
,
z
:
null
};
if
(
data
.
length
<
2
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment