From b6d5047a39faf861a1b86327eae0e4052f9dfe32 Mon Sep 17 00:00:00 2001
From: amandaghassaei <amandaghassaei@gmail.com>
Date: Sat, 14 Mar 2015 17:51:33 -0400
Subject: [PATCH] debugging, working with shopbot now

---
 js/cam/Assembler.js       | 18 +++++++++++-------
 js/cam/ShopbotExporter.js |  4 ++++
 js/models/AppState.js     |  3 ++-
 3 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/js/cam/Assembler.js b/js/cam/Assembler.js
index 7157660c..5977aa7e 100644
--- a/js/cam/Assembler.js
+++ b/js/cam/Assembler.js
@@ -20,8 +20,8 @@ Assembler = Backbone.Model.extend({
         stock: null,
         stockPosition: new THREE.Vector3(20,0,0),
 
-        rapidSpeeds:{xy: 3, z: 1},
-        feedRate:{xy: 0.1, z: 0.1}
+        rapidSpeeds:{xy: 3, z: 2},//rapids at clearance height
+        feedRate:{xy: 0.1, z: 0.1},//speed when heading towards assembly
     },
 
     initialize: function(options){
@@ -145,14 +145,18 @@ Assembler = Backbone.Model.extend({
         dmaGlobals.lattice.rasterCells(this._getOrder(this.get("camStrategy")), function(cell){
             if (!cell) return;
 
-            data += exporter.rapidXY(stockPosition.x-wcs.x, stockPosition.y-wcs.y);
-            data += exporter.moveZ(stockHeight);
-            data += exporter.moveZ(rapidHeight);
+            data += exporter.rapidXY(stockPosition.x, stockPosition.y);
+            data += exporter.rapidZ(stockPosition.z+0.5);
+            data += exporter.moveZ(stockPosition.z);
+            data += exporter.moveZ(stockPosition.z+0.5);
+            data += exporter.rapidZ(rapidHeight);
 
             var cellPosition = cell.getPosition();
             data += exporter.rapidXY(cellPosition.x-wcs.x, cellPosition.y-wcs.y);
-            data += exporter.moveZ(stockHeight);
-            data += exporter.moveZ(rapidHeight);
+            data += exporter.rapidZ(cellPosition.z-wcs.z+0.5);
+            data += exporter.moveZ(cellPosition.z-wcs.z);
+            data += exporter.moveZ(cellPosition.z-wcs.z+0.5);
+            data += exporter.rapidZ(rapidHeight);
 
             data += "\n";
         });
diff --git a/js/cam/ShopbotExporter.js b/js/cam/ShopbotExporter.js
index 55358610..d6b135d1 100644
--- a/js/cam/ShopbotExporter.js
+++ b/js/cam/ShopbotExporter.js
@@ -47,6 +47,10 @@ ShopbotExporter.prototype.rapidXY = function(x, y){
     return this.addLine("J2", [x,y]);
 };
 
+ShopbotExporter.prototype.rapidZ = function(z){
+    return this.rapidXYZ("", "", z);
+};
+
 ShopbotExporter.prototype.moveXYZ = function(x, y, z){
     return this.addLine("M3", [x,y,z]);
 };
diff --git a/js/models/AppState.js b/js/models/AppState.js
index a0c15228..19a30484 100644
--- a/js/models/AppState.js
+++ b/js/models/AppState.js
@@ -240,7 +240,8 @@ AppState = Backbone.Model.extend({
                 break;
             case 68://d delete mode
                 console.log(state);
-                if (dmaGlobals.lattice.get("cellMode") == "cell") this.set("deleteMode", state);//only for cell mode
+                console.log(dmaGlobals.lattice.get("cellMode"));
+                if (this.get("cellMode") == "cell") this.set("deleteMode", state);//only for cell mode
                 else this.set("deleteMode", false);
                 break;
             case 69://e
-- 
GitLab