Skip to content
Snippets Groups Projects
Commit 1b45512a authored by Amanda Ghassaei's avatar Amanda Ghassaei
Browse files

simple animation of one bit bot working

parent b602090b
No related branches found
No related tags found
No related merge requests found
{"lattice":{"units":"inches","scale":2.78388,"cellSeparation":{"xy":0,"z":0},"cellType":"octa","connectionType":"edgeRot","partType":"vox","shouldPreserveCells":true},"assembler":{"camStrategy":"raster","placementOrder":"-X-YZ","camProcess":"gcode","machineName":"oneBitBot","rapidHeight":6.9,"rapidHeightRelative":true,"safeHeight":0.5,"originPosition":{"x":-1.39194,"y":1.39194,"z":0},"stockPosition":{"x":5.6081,"y":1.3919,"z":2},"stockPositionRelative":true,"multipleStockPositions":false,"stockArraySize":{"x":4,"y":4},"stockSeparation":2.78388,"rapidSpeeds":{"xy":6,"z":4},"feedRate":{"xy":0.1,"z":0.1},"simSpeed":4,"simStockNum":0,"stockHeight":0}}
\ No newline at end of file
{"lattice":{"units":"inches","scale":2.78388,"cellSeparation":{"xy":0,"z":0},"cellType":"octa","connectionType":"edgeRot","partType":"vox","shouldPreserveCells":true},"assembler":{"camStrategy":"raster","placementOrder":"XYZ","camProcess":"gcode","machineName":"oneBitBot","rapidHeight":4.5,"rapidHeightRelative":true,"safeHeight":0.5,"originPosition":{"x":-1.39194,"y":1.39194,"z":0},"stockPosition":{"x":5.6081,"y":1.3919,"z":2},"stockPositionRelative":true,"multipleStockPositions":false,"stockArraySize":{"x":4,"y":4},"stockSeparation":2.78388,"rapidSpeeds":{"xy":6,"z":4},"feedRate":{"xy":0.1,"z":0.1},"simSpeed":"10","simStockNum":0,"stockHeight":0}}
\ No newline at end of file
......@@ -97,7 +97,7 @@ GCodeExporter.prototype.simulate = function(line, machine, wcs, callback){
}
if (line.substr(0,3) == "G01"){
//return this._simulateGetPosition(line, dmaGlobals.assembler.get("feedRate"), machine, wcs, callback);
return this._simulateGetPosition(line, dmaGlobals.assembler.get("rapidSpeeds"), machine, wcs, callback);
return this._simulateGetPosition(line, dmaGlobals.assembler.get("feedRate"), machine, wcs, callback);
} else {
console.warn("problem parsing gcode: " + line);
return callback();
......
......@@ -265,7 +265,7 @@ OneBitBot.prototype._buildMeshes = function(callback){
return geometry;
}
function meshPrep(geometry, name){
geometry.applyMatrix(new THREE.Matrix4().makeTranslation(-10-1.3919,-12.8,-1.9685));
geometry.applyMatrix(new THREE.Matrix4().makeTranslation(-10,-12.8,0));
var mesh = new THREE.Mesh(geometry, new THREE.MeshLambertMaterial({color:0xaaaaaa, shading: THREE.FlatShading}));
meshes[name] = mesh;
if (allLoaded()) callback(meshes);
......@@ -273,7 +273,7 @@ OneBitBot.prototype._buildMeshes = function(callback){
var loader = new THREE.STLLoader();
loader.load("assets/stls/oneBitBot/zAxis.STL", function(geometry){
geometryScale(geometry);
geometry.applyMatrix(new THREE.Matrix4().makeTranslation(5,-2.4,-0.8));
geometry.applyMatrix(new THREE.Matrix4().makeTranslation(5,-2.4,-0.8-1.9685));
meshPrep(geometry, "zAxis");
});
loader.load("assets/stls/oneBitBot/zDrive.STL", function(geometry){
......@@ -299,17 +299,31 @@ OneBitBot.prototype._moveTo = function(x, y, z, speed, wcs, callback){
if (totalThreads > 0) return;
callback();
}
var startingPos = this.meshes["basePlate"].position.clone();
var startingPos = this.meshes["zAxis"].position.clone();
speed = this._normalizeSpeed(startingPos, x, y, this._reorganizeSpeed(speed));
this._moveAxis(startingPos.x, x, "x", speed.x, sketchyCallback);
this._moveAxis(startingPos.y, y, "y", speed.y, sketchyCallback);
this._moveAxis(startingPos.z, z, "z", speed.z, sketchyCallback);
this._moveXAxis(startingPos.x, x, "x", speed.x, sketchyCallback);
this._moveYAxis(startingPos.y, y, "y", speed.y, sketchyCallback);
this._moveZAxis(startingPos.z, z, "z", speed.z, sketchyCallback);
};
OneBitBot.prototype._moveAxis = function(startingPos, target, axis, speed, callback){
OneBitBot.prototype._moveXAxis = function(startingPos, target, axis, speed, callback){
if (target == null || target === undefined) {
callback();
return;
}
this._animateObjects([this.meshes["zAxis"], this.meshes["zDrive"], this.meshes["yAxisMount"], this.cell], axis, speed, startingPos, target, callback);
};
OneBitBot.prototype._moveYAxis = function(startingPos, target, axis, speed, callback){
if (target == null || target === undefined) {
callback();
return;
}
this._animateObjects([this.meshes["zAxis"], this.meshes["zDrive"], this.cell], axis, speed, startingPos, target, callback);
};
OneBitBot.prototype._moveZAxis = function(startingPos, target, axis, speed, callback){
if (target == null || target === undefined) {
callback();
return;
}
this._animateObjects(_.values(this.meshes).concat(this.cell), axis, speed, startingPos, target, callback);
this._animateObjects([this.meshes["zAxis"], this.cell], axis, speed, startingPos, target, callback);
};
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment