From 0a2a6f75c65e5d7671e7eec7ce48b7835b6212d8 Mon Sep 17 00:00:00 2001
From: amandaghassaei <amandaghassaei@gmail.com>
Date: Sat, 14 Mar 2015 03:53:20 -0400
Subject: [PATCH] cleanup

---
 js/cam/Assembler.js | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/js/cam/Assembler.js b/js/cam/Assembler.js
index 2d92f056..5242d67a 100644
--- a/js/cam/Assembler.js
+++ b/js/cam/Assembler.js
@@ -109,6 +109,13 @@ Assembler = Backbone.Model.extend({
         } else console.warn("cam process not supported");
     },
 
+    _getOrder: function(strategy){
+        if (strategy == "xRaster") return "XYZ";
+        if (strategy == "yRaster") return "YXZ";
+        console.warn("strategy not recognized");
+        return "";
+    },
+
     postProcess: function(){
         this.set("needsPostProcessing", false);
         var exporter = this._getExporter();
@@ -123,14 +130,10 @@ Assembler = Backbone.Model.extend({
         var stockHeight = this.get("stockHeight");
         data += exporter.moveZ(rapidHeight);
         data += "\n";
-        var wcs = this.get("originPosition");
 
-        var strategy = this.get("camStrategy");
-        var order;
-        if (strategy == "xRaster") order = "XYZ";
-        else if (strategy == "yRaster") order = "YXZ";
+        var wcs = this.get("originPosition");
         var stockPosition = this.get("stockPosition");
-        dmaGlobals.lattice.rasterCells(order, function(cell, x, y, z){
+        dmaGlobals.lattice.rasterCells(this._getOrder(this.get("camStrategy"), function(cell){
             if (!cell) return;
 
             data += exporter.rapidXY(stockPosition.x-wcs.x, stockPosition.y-wcs.y);
-- 
GitLab