diff --git a/js/cam/Assembler.js b/js/cam/Assembler.js index c7339c30bfe0d99765fe677df6eb78de164ebf57..c8c0496f320dbbe707d088924f17fd48267f5fff 100644 --- a/js/cam/Assembler.js +++ b/js/cam/Assembler.js @@ -123,7 +123,8 @@ Assembler = Backbone.Model.extend({ var allLines = this.get("dataOut").split("\n"); if(currentLine<allLines.length){ var self = this; - this.get("exporter").simulate(allLines[currentLine], this.get("machine"), function(){ + this.get("exporter").simulate(allLines[currentLine], this.get("machine"), + this.get("originPosition"), function(){ currentLine++; self.set("simLineNumber", currentLine); self._stockSimulation(); diff --git a/js/cam/Machine.js b/js/cam/Machine.js index 5745d77ebbda9f3e50259c2de63681041e7da1d4..cf0dddf72ad0d60fde8cbc68c0d86621e258112f 100644 --- a/js/cam/Machine.js +++ b/js/cam/Machine.js @@ -13,12 +13,12 @@ Machine.prototype.pause = function(){ }; -Machine.prototype.moveTo = function(x, y, z, speed, callback){ +Machine.prototype.moveTo = function(x, y, z, speed, wcs, callback){ var self = this; setTimeout( function() { - if (x != "") self.mesh.position.x = x; - if (y != "") self.mesh.position.y = y; - if (z != "") self.mesh.position.z = z; + if (x != "") self.mesh.position.x = parseFloat(x)+wcs.x; + if (y != "") self.mesh.position.y = parseFloat(y)+wcs.y; + if (z != "") self.mesh.position.z = parseFloat(z)+wcs.z; dmaGlobals.three.render(); return callback(); }, 300); diff --git a/js/cam/ShopbotExporter.js b/js/cam/ShopbotExporter.js index 68c756a5f9fb4ce23a10e0e6e9c3605a1434af46..43c315a33e21b8f884c8ae4795790146b2d5371f 100644 --- a/js/cam/ShopbotExporter.js +++ b/js/cam/ShopbotExporter.js @@ -83,21 +83,21 @@ ShopbotExporter.prototype.convertToInches = function(mm){ }; -ShopbotExporter.prototype.simulate = function(line, machine, callback){ +ShopbotExporter.prototype.simulate = function(line, machine, wcs, callback){ if (line == "" || line[0] == "'" || (line[0] != "J" && line[0] != "M")) { return callback(); } if (line[0] == "J"){ - return this.simulateGetPosition(line, dmaGlobals.assembler.get("rapidSpeeds"), machine, callback); + return this.simulateGetPosition(line, dmaGlobals.assembler.get("rapidSpeeds"), machine, wcs, callback); } else if (line[0] == "M"){ - return this.simulateGetPosition(line, dmaGlobals.assembler.get("feedRate"), machine, callback); + return this.simulateGetPosition(line, dmaGlobals.assembler.get("feedRate"), machine, wcs, callback); } else { console.warn("problem parsing sbp"); return callback(); } }; -ShopbotExporter.prototype.simulateGetPosition = function(line, speed, machine, callback){ +ShopbotExporter.prototype.simulateGetPosition = function(line, speed, machine, wcs, callback){ if (line[1] == 3 || line[1] == 2) { var data = line.split(" "); for (var i=0;i<data.length;i++){ @@ -105,10 +105,9 @@ ShopbotExporter.prototype.simulateGetPosition = function(line, speed, machine, c if (item[item.length-1] == ",") data[i] = item.substring(0, item.length - 1) } if (line[1] == 3){ - console.log(machine); - machine.moveTo(data[1], data[2], data[3], speed, callback); + machine.moveTo(data[1], data[2], data[3], speed, wcs, callback); } else { - machine.moveTo(data[1], data[2], "", speed, callback); + machine.moveTo(data[1], data[2], "", speed, wcs, callback); } } else if (line[1] == "S"){ return callback(); diff --git a/js/models/AppState.js b/js/models/AppState.js index 87633b930dc915e3c02523afb900c0f112e45848..bb47ffb09c1968bb832694419c92e434c80cc000 100644 --- a/js/models/AppState.js +++ b/js/models/AppState.js @@ -328,7 +328,6 @@ AppState = Backbone.Model.extend({ loadUser: function(data, isParsed){ if (!isParsed) data = JSON.parse(data); - console.log(data); this._setData(data, false); },