From 848d45e2f5deb99c36898e82dd213551d25e689f Mon Sep 17 00:00:00 2001
From: amandaghassaei <amandaghassaei@gmail.com>
Date: Sat, 14 Mar 2015 15:02:23 -0400
Subject: [PATCH] working on shopbot

---
 js/cam/Assembler.js       | 14 ++++++++------
 js/cam/ShopbotExporter.js |  2 +-
 js/fea/DmaBeam.js         |  4 ++++
 js/models/Lattice.js      | 12 ++++++------
 4 files changed, 19 insertions(+), 13 deletions(-)

diff --git a/js/cam/Assembler.js b/js/cam/Assembler.js
index c74d1870..7157660c 100644
--- a/js/cam/Assembler.js
+++ b/js/cam/Assembler.js
@@ -13,15 +13,15 @@ Assembler = Backbone.Model.extend({
         needsPostProcessing: true,
         editsMadeToProgram: false,//warn the user that they will override changes
 
-        rapidHeight: 12,
-        stockHeight: 3,
+        rapidHeight: 6,
+        stockHeight: 0,
         origin: null,
-        originPosition: new THREE.Vector3(0,0,0),
+        originPosition: new THREE.Vector3(20,0,0),
         stock: null,
-        stockPosition: new THREE.Vector3(0,0,0),
+        stockPosition: new THREE.Vector3(20,0,0),
 
-        rapidSpeeds:{xy: 12, z: 4},
-        feedRate:{xy: 12, z: 4}
+        rapidSpeeds:{xy: 3, z: 1},
+        feedRate:{xy: 0.1, z: 0.1}
     },
 
     initialize: function(options){
@@ -54,11 +54,13 @@ Assembler = Backbone.Model.extend({
             new THREE.MeshBasicMaterial({color:0xff0000}));
         dmaGlobals.three.sceneAdd(origin);
         this.set("origin", origin);
+        this._moveOrigin();
         //init stock mesh
         var stock = new THREE.Mesh(new THREE.SphereGeometry(1),
             new THREE.MeshBasicMaterial({color:0xff00ff}));
         dmaGlobals.three.sceneAdd(stock);
         this.set("stock", stock);
+        this._moveStock();
         this._setCAMScale(options.lattice.get("scale"));
         this._setCAMVisibility();
     },
diff --git a/js/cam/ShopbotExporter.js b/js/cam/ShopbotExporter.js
index 06394390..55358610 100644
--- a/js/cam/ShopbotExporter.js
+++ b/js/cam/ShopbotExporter.js
@@ -7,7 +7,7 @@ function ShopbotExporter() {
 
 ShopbotExporter.prototype.makeHeader = function(){
     var data = "";
-    data += this.addLine("FG", [], "single step mode");
+    //data += this.addLine("FG", [], "single step mode");
     data += this.addLine("SA", [], "absolute distances");
     data += this.addLine("SM", [], "move/cut mode");
     var rapidSpeeds = dmaGlobals.assembler.get("rapidSpeeds");
diff --git a/js/fea/DmaBeam.js b/js/fea/DmaBeam.js
index befdfe32..b5cbb9e3 100644
--- a/js/fea/DmaBeam.js
+++ b/js/fea/DmaBeam.js
@@ -95,4 +95,8 @@ DmaBeam.prototype.calcStiffnessMatrix = function(){
 //  	];
 };
 
+DmaBeam.prototype.toJSON = function(){
+
+}
+
 
diff --git a/js/models/Lattice.js b/js/models/Lattice.js
index 36e4fb43..936cef7d 100644
--- a/js/models/Lattice.js
+++ b/js/models/Lattice.js
@@ -7,7 +7,7 @@ Lattice = Backbone.Model.extend({
 
     defaults: {
 
-        units: "mm",
+        units: "inches",
 
         nodes: [],
         cells: [[[null]]],//3D matrix containing all cells and null, dynamic size
@@ -16,7 +16,7 @@ Lattice = Backbone.Model.extend({
         numCells: 0,
 
         basePlane: null,//plane to build from
-        scale: 20,
+        scale: 2.78388,
         highlighter: null,//highlights build-able surfaces
         //todo this is not exposed in ui, is that useful?
         shouldPreserveCells: true,//preserve cells when changing lattice type
@@ -25,8 +25,8 @@ Lattice = Backbone.Model.extend({
         cellSeparation: {xy:0, z:0},
 
         cellType: "octa",
-        connectionType: "face",
-        partType: "triangle"
+        connectionType: "edgeRot",
+        partType: "beam"
     },
 
     //pass in fillGeometry
@@ -508,10 +508,10 @@ Lattice = Backbone.Model.extend({
 
     saveJSON: function(name){
         if (!name) name = "lattice";
-        var assemblerData = _.omit(dmaGlobals.assembler.toJSON(), ["origin", "stock", "exporter"]);
+        var assemblerData = _.omit(dmaGlobals.assembler.toJSON(), ["origin", "stock", "exporter", "appState", "lattice"]);
         if (!dmaGlobals.assembler.get("editsMadeToProgram")) assemblerData.dataOut = "";
         var data = JSON.stringify({
-            lattice:_.omit(this.toJSON(), ["highlighter", "basePlane"]),
+            lattice:_.omit(this.toJSON(), ["highlighter", "basePlane", "nodes", "appState"]),
             assembler: assemblerData
         });
         var blob = new Blob([data], {type: "text/plain;charset=utf-8"});
-- 
GitLab