diff --git a/js/cam/Assembler.js b/js/cam/Assembler.js index 8c0fa893323a9bda3461712d4868af6d4dfe22a0..17608f362de35f22cf80ef52b7a357d2c4e9d829 100644 --- a/js/cam/Assembler.js +++ b/js/cam/Assembler.js @@ -60,7 +60,8 @@ Assembler = Backbone.Model.extend({ "change:stockArraySize " + "change:stockSeparation " + "change:multipleStockPositions " + - "change:rapidHeight", + "change:rapidHeight " + + "change:machineName", this._setNeedsPostProcessing); this.listenTo(options.lattice, "change:numCells " + @@ -76,6 +77,8 @@ Assembler = Backbone.Model.extend({ this.listenTo(options.lattice, "change:cellType change:connectionType", this._updateCellType); this.listenTo(options.appState, "change:cellMode", this._updateCellMode); + this.listenTo(this, "change:machineName", this._changeMachine); + this._initOriginAndStock(options.lattice); }, @@ -88,23 +91,25 @@ Assembler = Backbone.Model.extend({ ////////////////////////////////VISUALIZATION////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////// - _isVisible: function(){ + _changeMachine: function(){ + + }, + + isVisible: function(){ var currentTab = dmaGlobals.appState.get("currentTab"); return (currentTab == "cam" || currentTab == "animate" || currentTab == "send"); }, _updateCellType: function(){ this.get("machine").updateCellType(); - this.get("machine").setVisibility(this._isVisible()); }, _updatePartType: function(){ this.get("machine").updatePartType(); - this.get("machine").setVisibility(this._isVisible()); }, _updateCellMode: function(){ - this.get("machine").setVisibility(this._isVisible()); + this.get("machine").setVisibility(this.isVisible()); dmaGlobals.three.render(); }, @@ -120,7 +125,7 @@ Assembler = Backbone.Model.extend({ }, _setCAMVisibility: function(){ - var visible = this._isVisible(); + var visible = this.isVisible(); this.get("origin").visible = visible; this.get("stock").visible = visible; this.get("machine").setVisibility(visible); diff --git a/js/cam/Machine.js b/js/cam/Machine.js index c7a5c29aba9ee9cf0b66effc0f76a8d0b341358e..610dbc3a7c18fd061d81a5ec2b4c60f94dff9fab 100644 --- a/js/cam/Machine.js +++ b/js/cam/Machine.js @@ -20,6 +20,7 @@ function Machine() { } Machine.prototype.setVisibility = function(visible){ + if (visible == null || visible === undefined) visible = dmaGlobals.assembler.isVisible(); if (visible && this.hasStock) this.cell.draw(); else this.cell.hide(); this._setMeshesVisiblity(visible); @@ -38,11 +39,13 @@ Machine.prototype._makeStockCell = function(){ Machine.prototype.updateCellType = function(){ if (this.cell) this.cell.destroy(); this.cell = this._makeStockCell(); + this.setVisibility(); }; Machine.prototype.updatePartType = function(){ this.cell.destroyParts(); this.cell.draw(); + this.setVisibility(); }; Machine.prototype.pickUpStock = function(){ @@ -59,6 +62,10 @@ Machine.prototype.releaseStock = function(index){ Machine.prototype.pause = function(){ }; +Machine.prototype._animateMeshes = function(meshes, x, y, z, speed, callback){ + +}; + Machine.prototype.destroy = function(){ this.cell.destroy(); _.each(this.meshes, function(mesh){ @@ -97,7 +104,7 @@ Shopbot.prototype.moveTo = function(x, y, z, speed, wcs, callback){ var self = this; var endEffector = this.meshes[0]; setTimeout( function() { - //reaching a little deep here, might want to find a better solution + //todo reaching a little deep here, might want to find a better solution if (x != "") { var nextX = parseFloat(x)+wcs.x; endEffector.position.x = nextX;