[英]Implementing Revit to Excel Exporter in Autodesk Forge
我正在嘗試實現此處討論的Revit to Excel導出器。 該按鈕正在工作,並將urn和令牌傳遞給
ForgeXLS.downloadXLSX(urn, token, callback /*Optional*/);
我正在擴展在此處找到的Extensions Skeleton教程。
范圍是否可能有問題...如果是,那么您能否指導我如何調整我要提取的訪問令牌的范圍?
ForgeXLSX.downloadXLSX的代碼是:
downloadXLSX: function (urn, token, status) {
var fileName = decodeURIComponent(atob(urn).replace(/^.*[\\\/]/, '')) + '.xlsx';
if (fileName.indexOf('.rvt') == -1) {
if (status) status(true, 'Not a Revit file, aborting.');
return;
}
if (status) {
status(false, 'Preparing ' + fileName);
status(false, 'Reading project information....');
}
this.prepareTables(urn, token, function (tables) {
if (status) status(false, 'Building XLSX file...');
var wb = new Workbook();
jQuery.each(tables, function (name, table) {
if (name.indexOf('<')==-1) { // skip tables starting with <
var ws = ForgeXLS.sheetFromTable(table);
wb.SheetNames.push(name);
wb.Sheets[name] = ws;
}
});
var wbout = XLSX.write(wb, {bookType: 'xlsx', bookSST: true, type: 'binary'});
saveAs(new Blob([s2ab(wbout)], {type: "application/octet-stream"}), fileName);
if (status) status(true, 'Downloading...');
})
},
經過一番挖掘(和朋友的一些幫助)后,他們才發現這畢竟是范圍。 如果需要訪問權限,則可以在config.js文件中的公共范圍內添加“ data:read”范圍,現在導出程序可以正常工作了。
scopes: {
// Required scopes for the server-side application
internal: ['bucket:create', 'bucket:read', 'data:read', 'data:create', 'data:write'],
// Required scope for the client-side viewer
public: ['viewables:read', 'data:read']
}
在范圍上,您將需要兩個data:read bucket:read來具有對模型元數據的足夠訪問權限:
確保您的服務器在請求正文中正確設置了范圍,以獲取訪問令牌。
最好在ForgeXLS.forgeGetRequest處觀察調用Forge端點的過程中的URN和Token變量:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.