diff -r 800e8da193a7 -r dee15870206a stlviewer.js
--- a/stlviewer.js Thu Apr 06 15:03:40 2017 +0200
+++ b/stlviewer.js Thu Apr 06 15:41:04 2017 +0200
@@ -65,22 +65,39 @@
//console.log(data);
// remove all meshes
clear_scene();
+ var content = "
Material:
";
+ var weight = 0.0;
+ var length = 0;
+ var volume = 0;
// append the objects with positioning
for (i = 0; i";
if (obj[5] == "") {
// spacer
filename = "stl/spacer_" + obj[4][0] + '.stl';
material = 'm_spacer';
+ content += "Spacer: " + obj[4][0] + " (" + obj[4][1] + "mm)"
} else {
// cylinder
filename = "stl/cylinder_" + obj[5] + '.stl';
material = 'm_cylinder';
+ content += "Cylinder: " + obj[4][4] + " (" + obj[4][0] + "mm)"
+ weight += obj[4][3];
+ volume += obj[4][2];
+ if (obj[4][1] > length) length = obj[4][1];
}
position = [data.scale3d * 0.01 * obj[0], 0, 0];
loadSTL(filename, material + "", position);
+ content += ""
}
+ content += "
Total cylinder weight: " + Math.ceil(weight) + " kg
";
+ content += "Total cylinder volume: " + Math.floor(volume) + " ℓ
";
+ content += "Max cylinder length: " + Math.ceil(length / 10) + " cm
"
+
+ $("#infocontainer").html(content);
+
}
});
}