From 713ea0bc18ed4f35f2b68bdaef8f87795db045a6 Mon Sep 17 00:00:00 2001 From: Amanda Ghassaei <amandaghassaei@gmail.com> Date: Fri, 27 Mar 2015 03:46:45 -0400 Subject: [PATCH] machine defaults --- js/cam/Assembler.js | 1 + js/cam/Machine.js | 15 +++++++++------ js/menus/CamMenuView.js | 2 +- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/js/cam/Assembler.js b/js/cam/Assembler.js index f7639768..12dcd837 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 a652ce45..0a64aee4 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 c9b9be63..bcdd795d 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>\ -- GitLab