diff --git a/js/cam/Assembler.js b/js/cam/Assembler.js index 49412e6d2574fccafae6298a9ad8be99637700b3..2091e02cf014b76da17291a260cef7cc0350fdc5 100644 --- a/js/cam/Assembler.js +++ b/js/cam/Assembler.js @@ -28,7 +28,6 @@ Assembler = Backbone.Model.extend({ multipleStockPositions: false, stockArraySize: {x:4, y:4}, stockSeparation: 2.78388, - postStockNum: 0,//which piece of stock to pick up rapidSpeeds:{xy: 3, z: 2},//rapids at clearance height feedRate:{xy: 0.1, z: 0.1},//speed when heading towards assembly @@ -180,7 +179,6 @@ Assembler = Backbone.Model.extend({ dmaGlobals.appState.set("stockSimulationPlaying", false); dmaGlobals.three.stopAnimationLoop(); this.set("simStockNum", 0); - this.set("postStockNum", 0); dmaGlobals.lattice.showCells(); }, @@ -234,31 +232,23 @@ Assembler = Backbone.Model.extend({ data += "\n"; var stockPosition = this.get("stockPosition"); + var stockNum = 0;//position of stock in stock array var multStockPositions = this.get("multipleStockPositions"); var self = this; dmaGlobals.lattice.rasterCells(this._getOrder(this.get("camStrategy")), function(cell){ if (!cell) return; - var stockNum = self.get("postStockNum"); - var stockNumPosition = {x:stockPosition.x, y:stockPosition.y, z:stockPosition.z}; + var thisStockPosition = _.clone(stockPosition); if (multStockPositions) { var stockArraySize = self.get("stockArraySize"); - stockNumPosition.x += stockNum % stockArraySize.y * self.get("stockSeparation"); - stockNumPosition.y -= Math.floor(stockNum / stockArraySize.y) * self.get("stockSeparation"); - } - data += self._grabStock(exporter, stockNumPosition, rapidHeight, wcs, safeHeight); - if (multStockPositions) { + thisStockPosition.x += stockNum % stockArraySize.y * self.get("stockSeparation"); + thisStockPosition.y -= Math.floor(stockNum / stockArraySize.y) * self.get("stockSeparation"); stockNum += 1; if (stockNum >= stockArraySize.x * stockArraySize.y) stockNum = 0; - self.set("postStockNum", stockNum, {silent: true}); - data += exporter.rapidXY(stockPosition.x-wcs.x, stockPosition.y-wcs.y);//move to stock origin } + data += self._grabStock(exporter, thisStockPosition, rapidHeight, wcs, safeHeight); data += self._placeCell(cell, exporter, rapidHeight, wcs, safeHeight); - if (multStockPositions) { - data += exporter.rapidXY(stockPosition.x-wcs.x, stockPosition.y-wcs.y);//move to stock origin - } data += "\n"; }); - data += exporter.rapidXY(0, 0); data += "\n\n"; data += exporter.addComment("end program"); diff --git a/js/cam/GCodeExporter.js b/js/cam/GCodeExporter.js index ceba96c6190131c6b0004bfc5e988895006c3878..dec78ede65b224d1705fa93c8a56683524594ccf 100644 --- a/js/cam/GCodeExporter.js +++ b/js/cam/GCodeExporter.js @@ -73,7 +73,6 @@ GCodeExporter.prototype.goHome = function(){ GCodeExporter.prototype.makeFooter = function(){ var data = ""; - data += this.goHome(); data += this.addLine("M30", [], "program stop"); return data; diff --git a/js/cam/Machine.js b/js/cam/Machine.js index b394008e49597b50c2c849d12fc57c3ceb2e0862..11dd0ab82e1e7c0b4e9706181abf3b1e2bb6a6dc 100644 --- a/js/cam/Machine.js +++ b/js/cam/Machine.js @@ -14,6 +14,7 @@ function Machine() { _.each(_.values(meshes), function(mesh){ dmaGlobals.three.sceneAdd(mesh); }); + self.setVisibility(); }); this.cell = this._makeStockCell(); this.setVisibility(false); @@ -135,7 +136,6 @@ Machine.prototype.destroy = function(){ }; - /////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////SHOPBOT/////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////// @@ -181,6 +181,7 @@ Shopbot.prototype._moveAxis = function(startingPos, target, axis, speed, callbac this._animateObjects([this.meshes.endEffector, this.cell], axis, speed, startingPos, target, callback); }; + /////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////ONE BIT/////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/js/cam/ShopbotExporter.js b/js/cam/ShopbotExporter.js index d96101e0431d3be8e0253b657a7bdff07ce33adc..1ab7a52019b25941dca5462a42813f54d2794be5 100644 --- a/js/cam/ShopbotExporter.js +++ b/js/cam/ShopbotExporter.js @@ -70,7 +70,7 @@ ShopbotExporter.prototype.goHome = function(){ }; ShopbotExporter.prototype.makeFooter = function(){ - return this.goHome(); + return ""; }; ShopbotExporter.prototype.save = function(data){