Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Amanda Ghassaei
DMDesign
Commits
3d68a595
Commit
3d68a595
authored
Aug 19, 2015
by
Amanda Ghassaei
Browse files
backlash compensation
parent
00e0a48c
Changes
3
Hide whitespace changes
Inline
Side-by-side
js/cam/assemblers/AssemblerPost.js
View file @
3d68a595
...
...
@@ -21,7 +21,7 @@ define(['underscore', 'appState', 'lattice', 'cam'], function(_, appState, latti
this
.
customFunctionsContext
=
{
zClearHeight
:
8
,
//height above part to clear during assembly
zPreload
:
0.2
,
w
ait
:
0.75
,
//seconds
stockW
ait
:
0.75
,
//seconds
blOvershoot
:
1.0
};
...
...
@@ -58,25 +58,42 @@ define(['underscore', 'appState', 'lattice', 'cam'], function(_, appState, latti
return
data
;
};
this
.
customMoveXY
=
function
(
position
,
index
,
exporter
,
settings
,
context
){
this
.
customMoveXY
=
function
(
position
,
lastPosition
,
index
,
exporter
,
settings
,
context
){
//already offset for dual heads
var
data
=
""
;
var
overshoot
=
false
;
var
overshootPosition
=
position
.
clone
();
//always approach from +x +y direction
if
(
lastPosition
.
x
<
position
.
x
){
overshoot
=
true
;
overshootPosition
.
x
+=
context
.
blOvershoot
;
}
if
(
lastPosition
.
y
<
position
.
y
){
overshoot
=
true
;
overshootPosition
.
y
+=
context
.
blOvershoot
;
}
if
(
overshoot
)
data
+=
exporter
.
rapidXY
(
overshootPosition
,
settings
);
data
+=
exporter
.
rapidXY
(
position
,
settings
);
return
data
;
};
this
.
customPlacePart
=
function
(
position
,
index
,
material
,
exporter
,
settings
,
context
){
this
.
customPlacePart
=
function
(
position
,
index
,
material
,
exporter
,
settings
,
context
){
//already offset for dual heads
var
data
=
""
;
data
+=
exporter
.
rapidZ
(
position
.
z
+
settings
.
safeHeight
,
settings
);
data
+=
exporter
.
moveZ
(
position
.
z
,
settings
);
data
+=
exporter
.
moveZ
(
position
.
z
-
context
.
zPreload
,
settings
);
if
(
material
==
"
brass
"
)
data
+=
exporter
.
addLine
(
"
M3
"
);
else
if
(
material
==
"
fiberGlass
"
)
data
+=
exporter
.
addLine
(
"
M4
"
);
data
+=
exporter
.
addComment
(
JSON
.
stringify
(
index
));
data
+=
exporter
.
addLine
(
"
G4
"
,
[
"
P
"
+
context
.
w
ait
]);
data
+=
exporter
.
addLine
(
"
G4
"
,
[
"
P
"
+
context
.
stockW
ait
]);
data
+=
exporter
.
addLine
(
"
M5
"
);
data
+=
exporter
.
moveZ
(
position
.
z
,
settings
);
data
+=
exporter
.
moveZ
(
position
.
z
-
context
.
zPreload
,
settings
);
//need this line?
data
+=
exporter
.
moveZ
(
position
.
z
+
settings
.
safeHeight
,
settings
);
data
+=
exporter
.
rapidZ
(
position
.
z
+
context
.
zClearHeight
,
settings
);
...
...
@@ -182,13 +199,73 @@ define(['underscore', 'appState', 'lattice', 'cam'], function(_, appState, latti
position
.
sub
(
stock
.
getPosition
().
multiplyScalar
(
settings
.
scale
));
position
.
sub
(
settings
.
originPosition
);
data
+=
this
.
customMoveXY
(
position
.
clone
(),
index
.
clone
(),
exporter
,
settings
,
context
);
data
+=
this
.
customMoveXY
(
position
.
clone
(),
exporter
.
getPostPosition
(),
index
.
clone
(),
exporter
,
settings
,
context
);
data
+=
this
.
customPlacePart
(
position
,
index
,
material
,
exporter
,
settings
,
context
);
data
+=
this
.
customPlacePart
(
position
.
clone
(),
index
.
clone
()
,
material
,
exporter
,
settings
,
context
);
return
data
;
};
return
AssemblerPost
;
});
\ No newline at end of file
});
//don't delete
// this.customHeader = function(exporter, settings, context){
// var data = "";
// data += exporter.setUnits(lattice.get("units"));
// data += this.customHome(exporter, settings, context);
// return data;
// };
//
// this.customFooter = function(exporter, settings, context){
// var data = "";
// data += this.customHome(exporter, settings, context);
// return data;
// };
//
// this.customHome = function(exporter, settings, context){
// var data = "";
// data += exporter.goHome(settings);
// return data;
// };
//
// this.customPickUpStock = function(exporter, settings, context){//not relevant for your assembler
// var data = "";
// return data;
// };
//
// this.customChangeZLayer = function(currentIndex, lastIndex, exporter, settings, context){
// var data = "";
// if (lastIndex === null || (currentIndex.z-lastIndex.z)%2 != 0){
// data += exporter.addLine("G0", ["A" + (currentIndex.z%2*0.3125).toFixed(4)], "new layer");
// data += "\n";
// }
// return data;
// };
//
// this.customMoveXY = function(position, index, exporter, settings, context){//already offset for dual heads
// var data = "";
// data += exporter.rapidXY(position, settings);
// return data;
// };
//
// this.customPlacePart = function(position, index, material, exporter, settings, context){//already offset for dual heads
// var data = "";
// data += exporter.rapidZ(position.z + settings.safeHeight, settings);
// data += exporter.moveZ(position.z - context.zPreload, settings);
//
// if (material == "brass") data += exporter.addLine("M3");
// else if (material == "fiberGlass") data += exporter.addLine("M4");
//
// data += exporter.addComment(JSON.stringify(index));
//
// data += exporter.addLine("G4", ["P" + context.stockWait]);
// data += exporter.addLine("M5");
// data += exporter.moveZ(position.z - context.zPreload, settings);//need this line?
//
// data += exporter.moveZ(position.z + settings.safeHeight, settings);
// data += exporter.rapidZ(position.z + context.zClearHeight, settings);
// return data;
// };
\ No newline at end of file
js/cam/processes/GCodeExporter.js
View file @
3d68a595
...
...
@@ -2,11 +2,12 @@
* Created by aghassaei on 3/10/15.
*/
define
([
'
underscore
'
,
'
cam
'
,
'
lattice
'
],
function
(
_
,
cam
,
lattice
){
define
([
'
underscore
'
,
'
cam
'
,
'
lattice
'
,
'
three
'
],
function
(
_
,
cam
,
lattice
,
THREE
){
function
GCodeExporter
()
{
//keep track of speeds for F commands
this
.
postSpeed
=
null
;
this
.
postPosition
=
new
THREE
.
Vector3
(
0
,
0
,
0
);
this
.
animationSpeed
=
null
;
}
...
...
@@ -71,9 +72,18 @@ define(['underscore', 'cam', 'lattice'], function(_, cam, lattice){
};
GCodeExporter
.
prototype
.
_goXYZ
=
function
(
x
,
y
,
z
){
if
(
x
!==
null
)
x
=
"
X
"
+
parseFloat
(
x
).
toFixed
(
3
);
if
(
y
!==
null
)
y
=
"
Y
"
+
parseFloat
(
y
).
toFixed
(
3
);
if
(
z
!==
null
)
z
=
"
Z
"
+
parseFloat
(
z
).
toFixed
(
3
);
if
(
x
!==
null
)
{
x
=
"
X
"
+
parseFloat
(
x
).
toFixed
(
3
);
this
.
postPosition
.
x
=
x
;
}
if
(
y
!==
null
)
{
y
=
"
Y
"
+
parseFloat
(
y
).
toFixed
(
3
);
this
.
postPosition
.
y
=
y
;
}
if
(
z
!==
null
)
{
z
=
"
Z
"
+
parseFloat
(
z
).
toFixed
(
3
);
this
.
postPosition
.
z
=
z
;
}
return
this
.
addLine
(
"
G01
"
,
[
x
,
y
,
z
]);
};
...
...
@@ -82,6 +92,10 @@ define(['underscore', 'cam', 'lattice'], function(_, cam, lattice){
return
data
+
this
.
rapidXY
({
x
:
0
,
y
:
0
},
settings
);
};
GCodeExporter
.
prototype
.
getPostPosition
=
function
(){
return
this
.
postPosition
.
clone
();
};
...
...
js/plists/CamPList.js
View file @
3d68a595
...
...
@@ -128,7 +128,7 @@ define(['three'], function(THREE){
camProcess
:
"
gcode
"
,
rapidHeight
:
30
,
rapidHeightRelative
:
true
,
safeHeight
:
4
.5
,
safeHeight
:
4
,
originPosition
:
new
THREE
.
Vector3
(
0
,
0
,
0
),
rapidSpeeds
:{
xy
:
250
,
z
:
250
},
feedRate
:{
xy
:
6
,
z
:
6
}
...
...
Write
Preview
Supports
Markdown
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