From 46516cf716b8184050839299febc18a48f6992f1 Mon Sep 17 00:00:00 2001 From: Amanda Ghassaei <amandaghassaei@gmail.com> Date: Thu, 13 Aug 2015 17:15:26 -0400 Subject: [PATCH] cam menu back in order --- js/cam/Cam.js | 4 ++-- js/cam/assemblers/Assembler.js | 14 +++++++++++--- js/menus/CamMenuView.js | 2 +- js/menus/templates/CamMenuView.html | 8 ++++---- js/plists/CamPList.js | 4 ++-- 5 files changed, 20 insertions(+), 12 deletions(-) diff --git a/js/cam/Cam.js b/js/cam/Cam.js index 20f2d8de..4832f14d 100644 --- a/js/cam/Cam.js +++ b/js/cam/Cam.js @@ -52,7 +52,7 @@ define(['underscore', 'three', 'backbone', 'appState', 'latticeCAM', 'threeModel //bind events this.listenTo(appState, "change:currentTab", this._tabChanged); this.listenTo(appState, "change:currentNav", this._navChanged); -// this.listenTo(this, "change:originPosition", this._moveOrigin); + this.listenTo(this, "change:originPosition", this._moveOrigin); // this.listenTo(this, "change:stockPosition", this._moveStock); // this.listenTo(this, // "change:originPosition " + @@ -216,7 +216,7 @@ define(['underscore', 'three', 'backbone', 'appState', 'latticeCAM', 'threeModel // this.get("origin").position.set(position.x, position.y, position.z); if (this.get("stockFixed")) this._updateStockPosToOrigin(position, this.previous("originPosition")); three.render(); - if (this.get("assembler")) this.get("assembler").moveMachine(); + if (this.get("assembler")) this.get("assembler").moveMachine(position); }, _updateStockPosToOrigin: function(newOrigin, lastOrigin){ diff --git a/js/cam/assemblers/Assembler.js b/js/cam/assemblers/Assembler.js index a7194e66..f8a1fb7c 100644 --- a/js/cam/assemblers/Assembler.js +++ b/js/cam/assemblers/Assembler.js @@ -15,6 +15,11 @@ define(['underscore', 'appState', 'lattice', 'stlLoader', 'threeModel', 'cam', ' this.rotation = json.rotation; this.translation = json.translation; this.scale = json.scale; + this.shouldPickUpStock = json.shouldPickUpStock; + this.relative = json.relative; + this.camProcesses = json.camProcesses; + this.numMaterials = json.numMaterials; + this.object3D = new THREE.Object3D(); three.sceneAdd(this.object3D); @@ -118,8 +123,7 @@ define(['underscore', 'appState', 'lattice', 'stlLoader', 'threeModel', 'cam', ' assemblerMaterial.transparent = (appState.get("currentTab") == "cam" || appState.get("currentTab") == "assemblerSetup"); }; - Assembler.prototype.moveMachine = function(){//origin selection - var origin = cam.get("originPosition"); + Assembler.prototype.moveMachine = function(origin){//origin selection this.object3D.position.set(origin.x, origin.y, origin.z); three.render(); }; @@ -305,7 +309,11 @@ define(['underscore', 'appState', 'lattice', 'stlLoader', 'threeModel', 'cam', ' components: componentsJSON, translation: this.translation, scale: this.scale, - rotation: this.rotation + rotation: this.rotation, + shouldPickUpStock: this.shouldPickUpStock, + relative: this.relative, + camProcesses: this.camProcesses, + numMaterials: this.numMaterials } }; diff --git a/js/menus/CamMenuView.js b/js/menus/CamMenuView.js index c57dc0c6..6a9577d7 100644 --- a/js/menus/CamMenuView.js +++ b/js/menus/CamMenuView.js @@ -36,7 +36,7 @@ define(['jquery', 'underscore', 'menuParent', 'camPlist', 'cam', 'lattice', 'tex }, _makeTemplateJSON: function(){ - var data = _.extend(this.model.toJSON(), cam.toJSON(), lattice.toJSON(), camPlist); + var data = _.extend(this.model.toJSON(), cam.toJSON(), lattice.toJSON(), camPlist, cam.get("assembler").toJSON()); if (cam.get("stockPositionRelative")){ var relStockPos = {}; relStockPos.x = data.stockPosition.x - data.originPosition.x; diff --git a/js/menus/templates/CamMenuView.html b/js/menus/templates/CamMenuView.html index c632b019..8ab84d5b 100644 --- a/js/menus/templates/CamMenuView.html +++ b/js/menus/templates/CamMenuView.html @@ -1,7 +1,7 @@ CAM output: <div class="btn-group"> <button data-toggle="dropdown" class="btn dropdown-toggle" type="button"><%= allCamProcesses[camProcess] %><span class="caret"></span></button> <ul role="menu" class="dropdown-menu"> - <% _.each(allMachines[machineName].camProcesses, function(process){ %> + <% _.each(camProcesses, function(process){ %> <li><a class="assembler dropdownSelector" data-property="camProcess" data-value="<%= process %>" href="#"><%= allCamProcesses[process] %></a></li> <% }); %> </ul> @@ -11,8 +11,8 @@ Scale: <input data-property="scale" value="<%= scale %>" placeholder Units: <div class="btn-group"> <button data-toggle="dropdown" class="btn dropdown-toggle" type="button"><%= allUnitTypes[units] %><span class="caret"></span></button> <ul role="menu" class="dropdown-menu"> - <% _.each(_.keys(allUnitTypes), function(key){ %> - <li><a class="lattice dropdownSelector" data-property="units" data-value="<%= key %>" href="#"><%= allUnitTypes[key] %></a></li> + <% _.each(allUnitTypes, function(unit, key){ %> + <li><a class="lattice dropdownSelector" data-property="units" data-value="<%= key %>" href="#"><%= unit %></a></li> <% }); %> </ul> </div><br/><br/> @@ -23,7 +23,7 @@ Origin (xyz): <% if (!(machineName == "handOfGod")){ %><br/> <a id="manualSelectOrigin" class=" btn btn-lg btn-default btn-imageCustom<% if (manualSelectOrigin){ %> btn-selected<% } %>"><img src="assets/imgs/cursor.png"></a> <label> Manually select origin from existing cell</label><br/><br/> - <% if (assembler && !assembler.stockAttachedToEndEffector){ %> + <% if (assembler && assembler.shouldPickUpStock){ %> Stock (xyz): <input data-property="stockPosition" data-key="x" value="<%= stockPosition.x %>" placeholder="X" class="form-control floatInput assembler" type="text"> <input data-property="stockPosition" data-key="y" value="<%= stockPosition.y %>" placeholder="Y" class="form-control floatInput assembler" type="text"> diff --git a/js/plists/CamPList.js b/js/plists/CamPList.js index 4ac2fec9..bced04ce 100644 --- a/js/plists/CamPList.js +++ b/js/plists/CamPList.js @@ -118,9 +118,9 @@ define([], function(){ camStrategy: "raster", placementOrder: "XYZ",//used for raster strategy entry camProcess: "gcode", - rapidHeight:3, + rapidHeight:10, rapidHeightRelative: true, - safeHeight: 0.05, + safeHeight: 0.5, originPosition: {x:0,y:0,z:0}, rapidSpeeds:{xy: 3, z: 2}, feedRate:{xy: 0.1, z: 0.1} -- GitLab