diff --git a/js/cam/Assembler.js b/js/cam/Assembler.js index f7639768876897a9573f97a59ae13b536a971cf7..12dcd83731e4aa8a50e6886ee93c8f1b38d73768 100644 --- a/js/cam/Assembler.js +++ b/js/cam/Assembler.js @@ -81,6 +81,7 @@ Assembler = Backbone.Model.extend({ selectMachine: function(){ var machineName = this.get("machineName"); if (this.get("machine")) this.get("machine").destroy(); + this.set("machine", null); if (machineName == "shopbot"){ this.set("machine", new Shopbot()); } else if (machineName == "handOfGod"){ diff --git a/js/cam/Machine.js b/js/cam/Machine.js index a652ce453f50f9e4d9dcb67c86eb572280f93322..0a64aee4a20253f07ff6c4b33b190324ca5206b1 100644 --- a/js/cam/Machine.js +++ b/js/cam/Machine.js @@ -25,8 +25,10 @@ function Machine() { Machine.prototype._setDefaults = function(){ dmaGlobals.assembler.set("camProcess", "gcode"); + dmaGlobals.assembler.set("stockFixed", false); dmaGlobals.assembler.set("originPosition", {x:0,y:0,z:0}); dmaGlobals.assembler.set("stockPosition", {x:0,y:0,z:0}); + dmaGlobals.assembler.set("stockSeparation", dmaGlobals.lattice.xScale()); }; Machine.prototype.setVisibility = function(visible){ @@ -259,6 +261,12 @@ function Shopbot(){ } Shopbot.prototype = Object.create(Machine.prototype); +Shopbot.prototype._setDefaults = function(){ + Machine.prototype._setDefaults.call(this); + dmaGlobals.assembler.set("camProcess", "shopbot"); + dmaGlobals.assembler.set("stockPosition", {x:0,y:100,z:0});//todo calculate this +}; + Shopbot.prototype._buildMeshes = function(callback){ var meshes = {}; var material = this.material; @@ -274,11 +282,6 @@ Shopbot.prototype._buildMeshes = function(callback){ }); }; -Shopbot.prototype._setDefaults = function(){ - Machine.prototype._setDefaults.call(this); - dmaGlobals.assembler.set("camProcess", "shopbot"); -}; - Shopbot.prototype._moveAxis = function(startingPos, target, axis, speed, callback){ if (target == null || target === undefined) { callback(); @@ -299,7 +302,7 @@ God.prototype = Object.create(Machine.prototype); God.prototype._setDefaults = function(){ Machine.prototype._setDefaults.call(this); - dmaGlobals.assembler.set("stockPosition", {x:0,y:0,z:150}); + dmaGlobals.assembler.set("stockPosition", {x:0,y:0,z:150});//todo calculate this }; God.prototype._buildMeshes = function(callback){ diff --git a/js/menus/CamMenuView.js b/js/menus/CamMenuView.js index c9b9be632aac122e1a0ba8400aa76e926cb44493..bcdd795d0effb46feece73ceff07590983a9804f 100644 --- a/js/menus/CamMenuView.js +++ b/js/menus/CamMenuView.js @@ -177,7 +177,7 @@ CamMenuView = Backbone.View.extend({ <label class="checkbox" for="stockFixed">\ <input id="stockFixed" data-property="stockFixed" type="checkbox" <% if (stockFixed){ %> checked="checked"<% } %> value="" data-toggle="checkbox" class="custom-checkbox">\ <span class="icons"><span class="icon-unchecked"></span><span class="icon-checked"></span></span>\ - Fix stock to to Origin</label>\ + Fix stock relative to to Origin</label>\ <label class="checkbox" for="multipleStockPositions">\ <input id="multipleStockPositions" data-property="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>\