From 46e66e6ecd1612544384d5c85a0fb5a8cc9c9ef4 Mon Sep 17 00:00:00 2001
From: Fabian <fabian.neumann@ima-zlw-ifu.rwth-aachen.de>
Date: Sun, 4 Mar 2018 14:06:01 +0100
Subject: [PATCH] - runtime tests - exchanged stl (hope it works this time)

---
 index.html               |   5 +++--
 js/main.js               |  16 ++++++++++++----
 stl/SparkMaker_fixed.stl | Bin 0 -> 43084 bytes
 3 files changed, 15 insertions(+), 6 deletions(-)
 create mode 100644 stl/SparkMaker_fixed.stl

diff --git a/index.html b/index.html
index 2cfde39..9637ea2 100644
--- a/index.html
+++ b/index.html
@@ -5,6 +5,7 @@
         <meta http-equiv="X-UA-Compatible" content="IE=edge" />
         <meta name="viewport" content="width=device-width, initial-scale=1" />
         <title>SLAcer.js for SparkMaker (bêta)</title>
+        <link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />
         <link rel="stylesheet" type="text/css" href="vendor/jquery-ui/jquery-ui.min.css" />
         <link rel="stylesheet" type="text/css" href="vendor/bootstrap/css/bootstrap.min.css" />
         <link rel="stylesheet" type="text/css" href="vendor/bootstrap-slider/css/bootstrap-slider.min.css" />
@@ -22,7 +23,7 @@
                         <span class="icon-bar"></span>
                     </button>
                     <a class="navbar-brand" href="#">SLAcer.js for SparkMaker (beta)</a>
-                    <div class="navbar-brand">| Big thank you to lautr3k! (project core dev) see <a href="https://github.com/lautr3k/SLAcer.js">GitHub</a></div>
+                    <div class="navbar-brand"><small>↪Big thank you is due to lautr3k! (project core dev - see <a href="https://github.com/lautr3k/SLAcer.js">GitHub</a>)</small></div>
                 </div>
                 <div id="navbar" class="navbar-collapse collapse">
                     <ul class="nav navbar-nav navbar-right">
@@ -106,7 +107,7 @@ <h3 class="panel-title">File</h3>
                             <span class="btn btn-default btn-file btn-xs">
                                 Browse <input type="file" name="file" id="file-input" accept=".stl" />
                             </span>
-                            <small>Or drop an STL file anywhere.</small>
+                            <small>Or drop an STL file anywhere.<br>In case of error check your model <a href="https://service.netfabb.com/service.php">here</a>!</small>
                         </div>
                     </div>
                 </div><!-- #file -->
diff --git a/js/main.js b/js/main.js
index 8892285..e57ceb9 100644
--- a/js/main.js
+++ b/js/main.js
@@ -218,8 +218,8 @@ function getSlice(layerNumber) {
 
                 for(var w=0; w<data.length/height*4; w+=4) {
                     for(var h=w; h<width*height*4; h+=(4*width)) {
-                        if(data[h]!=0){
-                            array[(pixel/8) | 0] += Math.pow(2,(pixel%8))
+                        if(data[h]!==0){
+                            array[~~(pixel/8)] += Math.pow(2,(pixel%8))
                         }
                         pixel++;
                     }
@@ -233,6 +233,7 @@ function getSlice(layerNumber) {
 
                     //var binary_layer = (new TextDecoder("utf-8")).decode(array)
                     wowFile += bin2string(array);
+                    //wowFile += array.map(intBytetoHexBin);
                     wowFile += "\n";
 
                     if (settings.get('slicer.folder')) {
@@ -359,10 +360,16 @@ function bin2string(array){
     var result = "";
     for(var i = 0; i < array.length; ++i){
         result+= (String.fromCharCode(array[i]));
-        //result+= convertHexToString(array[i]);
+        //result+= intBytetoHexBin(array[i]);
     }
     return result;
 }
+// array.map(intBytetoHexBin);
+function intBytetoHexBin(value){
+    //var hex_array = ["\x00","\x01","\x02","\x03","\x04","\x05","\x06","\x07","\x08","\x09","\x0A","\x0B","\x0C","\x0D","\x0E","\x0F","\x10","\x11","\x12","\x13","\x14","\x15","\x16","\x17","\x18","\x19","\x1A","\x1B","\x1C","\x1D","\x1E","\x1F","\x20","\x21","\x22","\x23","\x24","\x25","\x26","\x27","\x28","\x29","\x2A","\x2B","\x2C","\x2D","\x2E","\x2F","\x30","\x31","\x32","\x33","\x34","\x35","\x36","\x37","\x38","\x39","\x3A","\x3B","\x3C","\x3D","\x3E","\x3F","\x40","\x41","\x42","\x43","\x44","\x45","\x46","\x47","\x48","\x49","\x4A","\x4B","\x4C","\x4D","\x4E","\x4F","\x50","\x51","\x52","\x53","\x54","\x55","\x56","\x57","\x58","\x59","\x5A","\x5B","\x5C","\x5D","\x5E","\x5F","\x60","\x61","\x62","\x63","\x64","\x65","\x66","\x67","\x68","\x69","\x6A","\x6B","\x6C","\x6D","\x6E","\x6F","\x70","\x71","\x72","\x73","\x74","\x75","\x76","\x77","\x78","\x79","\x7A","\x7B","\x7C","\x7D","\x7E","\x7F","\x80","\x81","\x82","\x83","\x84","\x85","\x86","\x87","\x88","\x89","\x8A","\x8B","\x8C","\x8D","\x8E","\x8F","\x90","\x91","\x92","\x93","\x94","\x95","\x96","\x97","\x98","\x99","\x9A","\x9B","\x9C","\x9D","\x9E","\x9F","\xA0","\xA1","\xA2","\xA3","\xA4","\xA5","\xA6","\xA7","\xA8","\xA9","\xAA","\xAB","\xAC","\xAD","\xAE","\xAF","\xB0","\xB1","\xB2","\xB3","\xB4","\xB5","\xB6","\xB7","\xB8","\xB9","\xBA","\xBB","\xBC","\xBD","\xBE","\xBF","\xC0","\xC1","\xC2","\xC3","\xC4","\xC5","\xC6","\xC7","\xC8","\xC9","\xCA","\xCB","\xCC","\xCD","\xCE","\xCF","\xD0","\xD1","\xD2","\xD3","\xD4","\xD5","\xD6","\xD7","\xD8","\xD9","\xDA","\xDB","\xDC","\xDD","\xDE","\xDF","\xE0","\xE1","\xE2","\xE3","\xE4","\xE5","\xE6","\xE7","\xE8","\xE9","\xEA","\xEB","\xEC","\xED","\xEE","\xEF","\xF0","\xF1","\xF2","\xF3","\xF4","\xF5","\xF6","\xF7","\xF8","\xF9","\xFA","\xFB","\xFC","\xFD","\xFE","\xFF"];
+    //return hex_array[value];
+    return ["\x00","\x01","\x02","\x03","\x04","\x05","\x06","\x07","\x08","\x09","\x0A","\x0B","\x0C","\x0D","\x0E","\x0F","\x10","\x11","\x12","\x13","\x14","\x15","\x16","\x17","\x18","\x19","\x1A","\x1B","\x1C","\x1D","\x1E","\x1F","\x20","\x21","\x22","\x23","\x24","\x25","\x26","\x27","\x28","\x29","\x2A","\x2B","\x2C","\x2D","\x2E","\x2F","\x30","\x31","\x32","\x33","\x34","\x35","\x36","\x37","\x38","\x39","\x3A","\x3B","\x3C","\x3D","\x3E","\x3F","\x40","\x41","\x42","\x43","\x44","\x45","\x46","\x47","\x48","\x49","\x4A","\x4B","\x4C","\x4D","\x4E","\x4F","\x50","\x51","\x52","\x53","\x54","\x55","\x56","\x57","\x58","\x59","\x5A","\x5B","\x5C","\x5D","\x5E","\x5F","\x60","\x61","\x62","\x63","\x64","\x65","\x66","\x67","\x68","\x69","\x6A","\x6B","\x6C","\x6D","\x6E","\x6F","\x70","\x71","\x72","\x73","\x74","\x75","\x76","\x77","\x78","\x79","\x7A","\x7B","\x7C","\x7D","\x7E","\x7F","\x80","\x81","\x82","\x83","\x84","\x85","\x86","\x87","\x88","\x89","\x8A","\x8B","\x8C","\x8D","\x8E","\x8F","\x90","\x91","\x92","\x93","\x94","\x95","\x96","\x97","\x98","\x99","\x9A","\x9B","\x9C","\x9D","\x9E","\x9F","\xA0","\xA1","\xA2","\xA3","\xA4","\xA5","\xA6","\xA7","\xA8","\xA9","\xAA","\xAB","\xAC","\xAD","\xAE","\xAF","\xB0","\xB1","\xB2","\xB3","\xB4","\xB5","\xB6","\xB7","\xB8","\xB9","\xBA","\xBB","\xBC","\xBD","\xBE","\xBF","\xC0","\xC1","\xC2","\xC3","\xC4","\xC5","\xC6","\xC7","\xC8","\xC9","\xCA","\xCB","\xCC","\xCD","\xCE","\xCF","\xD0","\xD1","\xD2","\xD3","\xD4","\xD5","\xD6","\xD7","\xD8","\xD9","\xDA","\xDB","\xDC","\xDD","\xDE","\xDF","\xE0","\xE1","\xE2","\xE3","\xE4","\xE5","\xE6","\xE7","\xE8","\xE9","\xEA","\xEB","\xEC","\xED","\xEE","\xEF","\xF0","\xF1","\xF2","\xF3","\xF4","\xF5","\xF6","\xF7","\xF8","\xF9","\xFA","\xFB","\xFC","\xFD","\xFE","\xFF"][value];
+}
 
 function BinToText(input) {
     return parseInt(input,2).toString(10);
@@ -1293,9 +1300,10 @@ loader.onError = errorHandler;
 // -----------------------------------------------------------------------------
 // example STL file
 //var stl = 'stl/Octocat-v2.stl';
-var stl = 'stl/StressTest.stl';
+//var stl = 'stl/StressTest.stl';
 //var stl = 'stl/SLAcer.stl';
 //var stl = 'stl/SparkMaker.stl';
+var stl = 'stl/SparkMaker_fixed.stl';
 
 
 // File url
diff --git a/stl/SparkMaker_fixed.stl b/stl/SparkMaker_fixed.stl
new file mode 100644
index 0000000000000000000000000000000000000000..e6479c128eb8f5eec3ea1ed5038b9c5059c0fe8d
GIT binary patch
