--- 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 = "<h2>Material:</h2><ul>"; + var weight = 0.0; + var length = 0; + var volume = 0; // append the objects with positioning for (i = 0; i<data.objects.length; i++) { var obj = data.objects[i]; + content += "<li>"; 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 += "</li>" } + content += "</ul><br/>Total cylinder weight: " + Math.ceil(weight) + " kg<br/>"; + content += "Total cylinder volume: " + Math.floor(volume) + " ℓ<br/>"; + content += "Max cylinder length: " + Math.ceil(length / 10) + " cm<br/>" + + $("#infocontainer").html(content); + } }); }