diff --git a/css/main.css b/css/main.css index ab5297385877f5fd2a3d5abebe82912d81a00e13..31db838ebc065303ed860a1d3782c0f23d5dd4dd 100644 --- a/css/main.css +++ b/css/main.css @@ -82,13 +82,13 @@ nav .btn { /*menus*/ #menuWrapper { - width: 450px; + width: 420px; height: 100%; z-index: 1; position: absolute; display: block; background-color: rgba(255,255,255,0.8); - right: -450px;/*initially hidden*/ + right: -420px;/*initially hidden*/ overflow:hidden; } diff --git a/js/cam/Assembler.js b/js/cam/Assembler.js index f8fa89dbe11e73eff774168d26fe3ec1634a4359..e618d88bbd7671a1d65a94c65f9cc00cce23d0af 100644 --- a/js/cam/Assembler.js +++ b/js/cam/Assembler.js @@ -24,7 +24,8 @@ Assembler = Backbone.Model.extend({ stock: null, stockPosition: new THREE.Vector3(20,0,0),//in abs coordinates stockPositionRelative: true, - stockArraySize: {x:3, y:3}, + multipleStockPositions: true, + stockArraySize: {x:4, y:4}, stockSeparation: 2.78388, postStockNum: 0,//which piece of stock to pick up @@ -55,6 +56,9 @@ Assembler = Backbone.Model.extend({ "change:camStrategy " + "change:placementOrder " + "change:safeHeight " + + "change:stockArraySize " + + "change:stockSeparation " + + "change:multipleStockPositions " + "change:rapidHeight", this._setNeedsPostProcessing); this.listenTo(options.lattice, @@ -203,19 +207,28 @@ Assembler = Backbone.Model.extend({ data += "\n"; var stockPosition = this.get("stockPosition"); + 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 stockArraySize = self.get("stockArraySize"); - stockNumPosition.x += stockNum % stockArraySize.y * self.get("stockSeparation"); - stockNumPosition.y -= Math.floor(stockNum / stockArraySize.y) * self.get("stockSeparation"); + 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); - stockNum += 1; - if (stockNum >= stockArraySize.x*stockArraySize.y) stockNum = 0; - self.set("postStockNum", stockNum, {silent:true}); + if (multStockPositions) { + 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._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); diff --git a/js/menus/CamMenuView.js b/js/menus/CamMenuView.js index 7442d585a3e21cc4fee5fbc6e1411d31cf50dd7b..5a48151b19b78cbea381f18b30054c2d3910cfb4 100644 --- a/js/menus/CamMenuView.js +++ b/js/menus/CamMenuView.js @@ -12,6 +12,7 @@ CamMenuView = Backbone.View.extend({ "click .units": "_changeUnits", "click #saveCam": "_save", "change #stockPosRel": "_changeStockPositionRelative", + "change #multipleStockPositions": "_changeMultipleStockPositions", "focusout .numberInput": "render" }, @@ -56,6 +57,8 @@ CamMenuView = Backbone.View.extend({ else if ($(".feedRate").is(":focus")) this._updateNumber(e, "feedRate"); else if ($(".safeHeight").is(":focus")) this._updateNumber(e, "safeHeight"); else if ($(".rapidHeight").is(":focus")) this._updateNumber(e, "rapidHeight"); + else if ($(".stockArraySize").is(":focus")) this._updateNumber(e, "stockArraySize"); + else if ($(".stockSeparation").is(":focus")) this._updateNumber(e, "stockSeparation"); }, _updateNumber: function(e, property){ @@ -89,6 +92,12 @@ CamMenuView = Backbone.View.extend({ dmaGlobals.assembler.set("stockPositionRelative", !dmaGlobals.assembler.get("stockPositionRelative")); }, + _changeMultipleStockPositions: function(e){ + e.preventDefault(); + $(e.target).blur(); + dmaGlobals.assembler.set("multipleStockPositions", !dmaGlobals.assembler.get("multipleStockPositions")); + }, + _save: function(e){ e.preventDefault(); this.assembler.save(); @@ -137,7 +146,16 @@ CamMenuView = Backbone.View.extend({ <label class="checkbox" for="stockPosRel">\ <input id="stockPosRel" type="checkbox" <% if (stockPositionRelative){ %> checked="checked"<% } %> value="" data-toggle="checkbox" class="custom-checkbox">\ <span class="icons"><span class="icon-unchecked"></span><span class="icon-checked"></span></span>\ - Stock position relative to Zero</label><br/>\ + Stock position relative to Zero</label>\ + <label class="checkbox" for="multipleStockPositions">\ + <input id="multipleStockPositions" type="checkbox" <% if (multipleStockPositions){ %> checked="checked"<% } %> value="" data-toggle="checkbox" class="custom-checkbox">\ + <span class="icons"><span class="icon-unchecked"></span><span class="icon-checked"></span></span>\ + Multiple stock positions</label>\ + <% if (multipleStockPositions){ %>\ + Stock dimensions (xy): <input data-type="x" value="<%= stockArraySize.x %>" placeholder="X" class="form-control numberInput stockArraySize" type="text">\ + <input data-type="y" value="<%= stockArraySize.y %>" placeholder="Y" class="form-control numberInput stockArraySize" type="text"><br/><br/>\ + Stock separation: <input value="<%= stockSeparation %>" placeholder="X" class="form-control numberInput stockSeparation" type="text"><br/><br/>\ + <% } %>\ Clearance Height: <input value="<%= rapidHeight %>" placeholder="Z" class="form-control numberInput rapidHeight" type="text"><br/><br/>\ Approach Height: <input value="<%= safeHeight %>" placeholder="Z" class="form-control numberInput safeHeight" type="text"><br/><br/>\ Speeds (measured in <%= units %> per second):<br/><br/>\ diff --git a/js/menus/MenuWrapperView.js b/js/menus/MenuWrapperView.js index 0adcb0ccfcf58fe682bd6af2e3c21f999ceb3ea0..827546632d96a4c0eb764fb8043ae0cb1c19b60b 100644 --- a/js/menus/MenuWrapperView.js +++ b/js/menus/MenuWrapperView.js @@ -111,7 +111,7 @@ MenuWrapper = Backbone.View.extend({ }, _hide: function(callback, suppressModelUpdate){ - this.$el.parent().animate({right: "-450"}, {done: callback}); + this.$el.parent().animate({right: "-420"}, {done: callback}); if (!suppressModelUpdate) this.model.set("menuIsVisible", false); }, diff --git a/js/menus/PartMenuView.js b/js/menus/PartMenuView.js index 0153d0f8e6880c87cec3d17c4570ccd782825760..2f7d62ee9ccf92e3abaee7c7ad204a766f52b004 100644 --- a/js/menus/PartMenuView.js +++ b/js/menus/PartMenuView.js @@ -7,7 +7,7 @@ PartMenuView = Backbone.View.extend({ el: "#menuContent", events: { - "click .partType": "_changePartType", + "click .partType": "_changePartType" }, initialize: function(options){