File size: 1,120 Bytes
b1f991e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | document.getElementById('processModelsBtn').addEventListener('click', function() {
var loadingIndicator = document.getElementById('final-loading-indicator');
loadingIndicator.style.display = 'inline-block';
var downloadLinkFinal = document.getElementById('download-link-final');
downloadLinkFinal.style.display = 'none';
downloadLinkFinal.href = '';
downloadLinkFinal.textContent = '';
fetch('/process_3d_models', {
method: 'GET'
})
.then(response => {
if (!response.ok) {
throw new Error('Failed to process the 3D models.');
}
return response.blob();
})
.then(blob => {
var url = window.URL.createObjectURL(blob);
downloadLinkFinal.href = url;
downloadLinkFinal.download = 'fitted_model.obj';
downloadLinkFinal.style.display = 'block';
downloadLinkFinal.textContent = 'Download Fitted 3D Model';
loadingIndicator.style.display = 'none';
})
.catch(error => {
console.error('There was an error:', error);
loadingIndicator.style.display = 'none';
});
});
|