From 8e248f99d07748d53f6f764765fce84bee20bb2d Mon Sep 17 00:00:00 2001
From: Amanda Ghassaei <amandaghassaei@gmail.com>
Date: Fri, 14 Aug 2015 19:24:24 -0400
Subject: [PATCH] eod

---
 js/cam/assemblers/Assembler.js    | 17 +++++------------
 js/cam/processes/GCodeExporter.js |  4 ++--
 2 files changed, 7 insertions(+), 14 deletions(-)

diff --git a/js/cam/assemblers/Assembler.js b/js/cam/assemblers/Assembler.js
index a94a17f9..2ced9b71 100644
--- a/js/cam/assemblers/Assembler.js
+++ b/js/cam/assemblers/Assembler.js
@@ -178,22 +178,14 @@ define(['underscore', 'appState', 'lattice', 'stlLoader', 'threeModel', 'cam', '
 //    };
     
     Assembler.prototype._postGetStock = function(index, position, settings, exporter){
-        var json = {
-            index:index,
-            position: position
-        };
-        return exporter.addComment("get stock " + JSON.stringify(json));
+        return exporter.addComment("get stock " + JSON.stringify(index));
     };
     
     Assembler.prototype._postReleaseStock = function(index, position, settings, exporter){
-        var json = {
-            index:index,
-            position: position
-        };
         var data = "";
         data += exporter.rapidZ(position.z-settings.originPosition.z+settings.safeHeight, settings);
         data += exporter.moveZ(position.z-settings.originPosition.z, settings);
-        data += exporter.addComment(JSON.stringify(json));
+        data += exporter.addComment(JSON.stringify(index));
         data += exporter.moveZ(position.z-settings.originPosition.z+settings.safeHeight, settings);
         data += exporter.rapidZ(settings.rapidHeight, settings);
         return data;
@@ -223,17 +215,18 @@ define(['underscore', 'appState', 'lattice', 'stlLoader', 'threeModel', 'cam', '
         });
     };
     
-    Assembler.prototype.pickUpStock = function(index, position, speed, settings, callback){
+    Assembler.prototype.pickUpStock = function(index, speed, settings, callback){
         _.each(this.stock, function(stock){
             stock.show();
         });
         if (index.z%2 != 0) {//rotate on odd rows
             this.components.frame.rotateTo(new THREE.Vector3(0, 0, Math.PI/2), speed, callback);
+            return;
         }
         this.components.frame.rotateTo(new THREE.Vector3(0, 0, 0), speed, callback);
     };
     
-    Assembler.prototype.releaseStock = function(index, position, settings){
+    Assembler.prototype.releaseStock = function(index, settings){
         lattice.showCellAtIndex(index);
         _.each(this.stock, function(stock){
             stock.hide();
diff --git a/js/cam/processes/GCodeExporter.js b/js/cam/processes/GCodeExporter.js
index f2e0f915..75dc048e 100644
--- a/js/cam/processes/GCodeExporter.js
+++ b/js/cam/processes/GCodeExporter.js
@@ -100,12 +100,12 @@ define(['underscore', 'cam', 'lattice'], function(_, cam, lattice){
         if (line.substr(0,10) == "(get stock"){
             var json = line.substr(11,line.length-12);
             json = JSON.parse(json);
-            return machine.pickUpStock(json.index, json.position, this.animationSpeed, settings, callback);
+            return machine.pickUpStock(json, this.animationSpeed, settings, callback);
         }
         if (line.substr(0,2) == "({"){
             var json = line.substr(1,line.length-2);
             json = JSON.parse(json);
-            machine.releaseStock(json.index, json.position, settings);
+            machine.releaseStock(json, settings);
             return callback();
         }
         if (line[0] == "F"){//speed
-- 
GitLab