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

eod

parent 40941ca2
No related branches found
No related tags found
No related merge requests found
...@@ -63,19 +63,20 @@ Machine.prototype.pause = function(){ ...@@ -63,19 +63,20 @@ Machine.prototype.pause = function(){
}; };
Machine.prototype._animateMesh = function(mesh, axis, speed, target, callback){ Machine.prototype._animateMesh = function(mesh, axis, speed, target, callback){
var increment = (target-mesh.position[axis])/20; var increment = 0.1/speed;//based on 1/10th of sec
if (increment == 0) { if (increment == 0) {
if (callback) callback(); if (callback) callback();
return; return;
} }
var direction = 1; var direction = 1;
if (increment<0) direction = -1; if (increment<0) direction = -1;
increment = Math.max(Math.abs(increment), 0.0001)*direction; increment = Math.max(Math.abs(increment), 0.00001)*direction;//need to put a min on the increment - other wise this stall out with floating pt tol
dmaGlobals.three.startAnimationLoop(); dmaGlobals.three.startAnimationLoop();
this._incrementalMove(mesh, axis, increment, target, direction, callback); var simSpeed = 100/dmaGlobals.assembler.get("simSpeed");//1/10th of sec
this._incrementalMove(mesh, axis, increment, target, direction, callback, simSpeed);
}; };
Machine.prototype._incrementalMove = function(mesh, axis, increment, target, direction, callback){ Machine.prototype._incrementalMove = function(mesh, axis, increment, target, direction, callback, simSpeed){
var self = this; var self = this;
setTimeout(function(){ setTimeout(function(){
if ((target-mesh.position[axis])*direction <= 0) { if ((target-mesh.position[axis])*direction <= 0) {
...@@ -84,8 +85,8 @@ Machine.prototype._incrementalMove = function(mesh, axis, increment, target, dir ...@@ -84,8 +85,8 @@ Machine.prototype._incrementalMove = function(mesh, axis, increment, target, dir
} }
if (Math.abs(target-mesh.position[axis]) < Math.abs(increment)) mesh.position[axis] = target;//don't overshoot if (Math.abs(target-mesh.position[axis]) < Math.abs(increment)) mesh.position[axis] = target;//don't overshoot
else mesh.position[axis] += increment; else mesh.position[axis] += increment;
self._incrementalMove(mesh, axis, increment, target, direction, callback) self._incrementalMove(mesh, axis, increment, target, direction, callback, simSpeed)
},100); },simSpeed);
}; };
Machine.prototype.destroy = function(){ Machine.prototype.destroy = function(){
...@@ -128,7 +129,7 @@ Shopbot.prototype.moveTo = function(x, y, z, speed, wcs, callback){ ...@@ -128,7 +129,7 @@ Shopbot.prototype.moveTo = function(x, y, z, speed, wcs, callback){
function sketchyCallback(){ function sketchyCallback(){
totalThreads -= 1; totalThreads -= 1;
if (totalThreads > 0) return; if (totalThreads > 0) return;
return callback(); callback();
} }
this._moveAxis(endEffector, x, "x", speed.xy, wcs, sketchyCallback); this._moveAxis(endEffector, x, "x", speed.xy, wcs, sketchyCallback);
this._moveAxis(endEffector, y, "y", speed.xy, wcs, sketchyCallback); this._moveAxis(endEffector, y, "y", speed.xy, wcs, sketchyCallback);
......
...@@ -77,6 +77,24 @@ CamMenuView = Backbone.View.extend({ ...@@ -77,6 +77,24 @@ CamMenuView = Backbone.View.extend({
else this.assembler.set(property, newVal); else this.assembler.set(property, newVal);
}, },
_updatePosNumber: function(e, property){
e.preventDefault();
var newVal = parseFloat($(e.target).val());
if (isNaN(newVal)) return;
newVal = parseFloat(newVal.toFixed(4));
if (newVal <= 0) {
console.warn("value must be positive");
return;
}
var object = this.assembler.get(property);
if ($(e.target).data("type")) {
object[$(e.target).data("type")] = newVal;
this.assembler.trigger("change:" + property);
this.assembler.trigger("change");
}
else this.assembler.set(property, newVal);
},
_updateRelativeStockPosition: function(e){ _updateRelativeStockPosition: function(e){
e.preventDefault(); e.preventDefault();
var newVal = parseFloat($(e.target).val()); var newVal = parseFloat($(e.target).val());
......
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