From 9aa23445ae923dc462fdc2e442e5fbce2cf4169c Mon Sep 17 00:00:00 2001 From: Amanda Ghassaei <amandaghassaei@gmail.com> Date: Tue, 24 Mar 2015 18:21:51 -0400 Subject: [PATCH] matt user settings --- data/users/matt.user | 1 + index.html | 1 + js/cam/Assembler.js | 9 +++++---- js/menus/AssemblerMenuView.js | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) create mode 100644 data/users/matt.user diff --git a/data/users/matt.user b/data/users/matt.user new file mode 100644 index 00000000..5e465ac1 --- /dev/null +++ b/data/users/matt.user @@ -0,0 +1 @@ +{"lattice":{"units":"inches","scale":2.78388,"cellSeparation":{"xy":0,"z":0},"cellType":"octa","connectionType":"edgeRot","partType":"vox","shouldPreserveCells":true},"assembler":{"camStrategy":"raster","placementOrder":"-X-YZ","camProcess":"gcode","machineName":"oneBitBot","rapidHeight":6.9,"rapidHeightRelative":true,"safeHeight":0.5,"originPosition":{"x":-1.39194,"y":1.39194,"z":0},"stockPosition":{"x":5.6081,"y":1.3919,"z":2},"stockPositionRelative":true,"multipleStockPositions":false,"stockArraySize":{"x":4,"y":4},"stockSeparation":2.78388,"rapidSpeeds":{"xy":6,"z":4},"feedRate":{"xy":0.1,"z":0.1},"simSpeed":4,"simStockNum":0,"stockHeight":0}} \ No newline at end of file diff --git a/index.html b/index.html index e35761c1..ba8a5e6c 100644 --- a/index.html +++ b/index.html @@ -116,6 +116,7 @@ <ul class="dropdown-menu"> <!--<li><a id="resetDefaultSettings" href="#">Reset Settings</a></li>--> <li><a data-file="ben.user" class="savedUserSettings" href="#">Ben</a></li> + <li><a data-file="matt.user" class="savedUserSettings" href="#">Matt</a></li> <li><a class="importJSON" href="#">From File...</a></li> </ul> </li> diff --git a/js/cam/Assembler.js b/js/cam/Assembler.js index bc0434f2..91029b67 100644 --- a/js/cam/Assembler.js +++ b/js/cam/Assembler.js @@ -75,12 +75,13 @@ Assembler = Backbone.Model.extend({ this.listenTo(options.lattice, "change:partType", this._updatePartType); this.listenTo(options.lattice, "change:cellType change:connectionType", this._updateCellType); this.listenTo(options.appState, "change:cellMode", this._updateCellMode); + this.listenTo(this, "change:machineName", this.selectMachine); this._initOriginAndStock(); }, - selectMachine: function(machineName){//todo put this on event - that way you know it is a change - if (!machineName) machineName = this.get("machineName"); + selectMachine: function(){ + var machineName = this.get("machineName"); if (this.get("machine")) this.get("machine").destroy(); if (machineName == "shopbot"){ this.set("machine", new Shopbot()); @@ -92,7 +93,6 @@ Assembler = Backbone.Model.extend({ this.set("machine", new OneBitBot()); this.set("camProcess", "gcode"); }else console.warn("selected machine not recognized"); - this.set("machineName", machineName); }, makeProgramEdits: function(data){ @@ -111,7 +111,8 @@ Assembler = Backbone.Model.extend({ _updateCellType: function(){ this.get("machine").updateCellType(); - this.selectMachine("handOfGod");//todo this should go away with dynamic allocation of this model + this.set("machineName", "handOfGod");//todo this should go away with dynamic allocation of this model + }, _updatePartType: function(){ diff --git a/js/menus/AssemblerMenuView.js b/js/menus/AssemblerMenuView.js index 12032f25..a27e1aae 100644 --- a/js/menus/AssemblerMenuView.js +++ b/js/menus/AssemblerMenuView.js @@ -48,7 +48,7 @@ AssemblerMenuView = Backbone.View.extend({ _selectMachine: function(e){ e.preventDefault(); - this.assembler.selectMachine($(e.target).data("type")); + this.assembler.set("MachineName", $(e.target).data("type")); }, render: function(){ -- GitLab