从Autodesk Forge 3D查看器下载文件 [英] Download file from Autodesk Forge 3D viewer

查看:85
本文介绍了从Autodesk Forge 3D查看器下载文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从Autodesk Forge中的3D查看器下载文件.我正在使用2条腿授权,并且可以将文件上传到存储桶,但是我不确定如何在3D查看器中从文件中下载文件.下面的代码下载文件,但其中不包含任何内容:

How do I download a file from the 3D viewer in Autodesk Forge. I am using 2 legged authorization and I am able to upload files to the bucket, but I am not sure how to download the file from them in the 3D viewer. The code below downloads files but there is nothing contained inside them:

var element = document.createElement('a');
element.setAttribute('href', '#');
element.setAttribute('download', node.text);
element.style.display = 'none';
document.body.appendChild(element);
element.click();
document.body.removeChild(element);

我已将此链接作为参考,但我不明白如何将其转换为Javascript或.NET中的代码: https://forge.autodesk.com/zh-CN/docs/data/v2/tutorials/download-file/

I have looked at this link as a reference but I don't understand how to convert this into code inside Javascript or .NET: https://forge.autodesk.com/en/docs/data/v2/tutorials/download-file/

推荐答案

我现在可以从Java下载文件,使用$.ajax和.NET中方法的url路径,然后使用:

I am able to download files now, from Javascript use $.ajax with the url path to the method in .NET then use:

WebClient client = new WebClient();
Uri address = new Uri(storageLocation);
fileName = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + @"\" + fileName;
client.Headers.Add("Content-Type", "application/octet-stream");
client.Headers.Add("Authorization", "Bearer " + credentials.TokenInternal);
client.DownloadFileAsync(address, fileName);
return client;

这会将文件下载到桌面.

This will download files to the desktop.

这篇关于从Autodesk Forge 3D查看器下载文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆