From 3b4acfe069134c244f08ffc3eb9c3156e8cd5473 Mon Sep 17 00:00:00 2001
From: amandaghassaei <amandaghassaei@gmail.com>
Date: Mon, 23 Mar 2015 01:45:10 -0400
Subject: [PATCH] mm support for shopbot

---
 js/cam/ShopbotExporter.js | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/js/cam/ShopbotExporter.js b/js/cam/ShopbotExporter.js
index 681461dd..d96101e0 100644
--- a/js/cam/ShopbotExporter.js
+++ b/js/cam/ShopbotExporter.js
@@ -82,6 +82,10 @@ ShopbotExporter.prototype.convertToInches = function(mm){
     return mm*0.0393701;
 };
 
+ShopbotExporter.prototype.convertToMM = function(inches){
+    return inches*25.4;
+};
+
 
 ShopbotExporter.prototype.simulate = function(line, machine, wcs,  callback){
     if (line == "'get stock"){
@@ -114,9 +118,11 @@ ShopbotExporter.prototype._simulateGetPosition = function(line, speed, machine,
             if (item[item.length-1] == ",") data[i] = item.substring(0, item.length - 1)
         }
         if (line[1] == 3){
-            machine.moveTo(data[1], data[2], data[3], speed, wcs, callback);
+            if (dmaGlobals.lattice.get("units") == "inches") machine.moveTo(data[1], data[2], data[3], speed, wcs, callback);
+            else machine.moveTo(this.convertToMM(data[1]), this.convertToMM(data[2]), this.convertToMM(data[3]), speed, wcs, callback);
         } else {
-            machine.moveTo(data[1], data[2], "", speed, wcs, callback);
+            if (dmaGlobals.lattice.get("units") == "inches") machine.moveTo(data[1], data[2], "", speed, wcs, callback);
+            else return machine.moveTo(this.convertToMM(data[1]), this.convertToMM(data[2]), "", speed, wcs, callback);
         }
     } else if (line[1] == "S"){
         return callback();
-- 
GitLab