30 $("#clearselected").click(function(){ |
30 $("#clearselected").click(function(){ |
31 $( "#sortable2 li" ).remove(); |
31 $( "#sortable2 li" ).remove(); |
32 for (i =0; i<10; i++) clear_scene(); |
32 for (i =0; i<10; i++) clear_scene(); |
33 }); |
33 }); |
34 update_scene(); |
34 update_scene(); |
|
35 |
|
36 $("#image2d").click(function() { |
|
37 var img = $("#image2d").clone(); |
|
38 //img.css('width', '100%'); |
|
39 img.css('margin', '0 auto'); |
|
40 $("<div>") |
|
41 .append(img) |
|
42 .dialog({ |
|
43 modal: true, |
|
44 draggable: false, |
|
45 resizable: false, |
|
46 title: "2D Layout view", |
|
47 height: window.innerHeight, |
|
48 width: window.innerWidth, |
|
49 buttons: { |
|
50 Close: function() { |
|
51 $( this ).dialog( "close" ); |
|
52 } |
|
53 } |
|
54 }); |
|
55 }); |
35 } ); |
56 } ); |
36 |
57 |
37 function clear_scene() { |
58 function clear_scene() { |
38 scene.children.forEach(function(v){ |
59 scene.children.forEach(function(v){ |
39 if(v.stlfile === true) { |
60 if(v.stlfile === true) { |
96 content += "Total cylinder volume: " + Math.floor(volume) + " ℓ<br/>"; |
117 content += "Total cylinder volume: " + Math.floor(volume) + " ℓ<br/>"; |
97 content += "Max cylinder length: " + Math.ceil(length / 10) + " cm<br/>" |
118 content += "Max cylinder length: " + Math.ceil(length / 10) + " cm<br/>" |
98 |
119 |
99 $("#infocontainer").html(content); |
120 $("#infocontainer").html(content); |
100 |
121 |
|
122 $("#image2d").attr('src', 'data:image/png;base64,' + data.image); |
|
123 |
101 } |
124 } |
102 }); |
125 }); |
103 } |
126 } |
104 |
127 |
105 function loadSTL(filename, material, position, rotation, scale) { |
128 function loadSTL(filename, material, position, rotation, scale) { |