1

我可以完成所有步驟來上傳Revit文件並在查看器中進行翻譯和加載。我正在嘗試下載已翻譯的SVG/SVF以供離線查看。我發現參考下面的端點以及與此測試了它:如何使用Autodesk Model Forge API下載SVG/SVF進行離線查看

function download(){ 
var uri = 'https://developer.api.autodesk.com/derivativeservice/v2/derivatives/<<urn>>' ; 
var authorizationHeader = 'Bearer <<token>>' 

request.get(
    { 
     url: uri,  
     headers: 
     { 
      'Authorization': authorizationHeader, 
      'Accept-Encoding': 'gzip, deflate' 
     }, 
    }, 

    function(error, response, body){ 
     if(!error){ 
      console.log(body); 
     }else{ 
      console.log(error); 
     } 
    }); 
} 

API返回:
{ 「診斷」: 「衍生API僅支持adsk.viewing & adsk.objects甕」}

回答

2

如果您希望抓取所有需要的文件以供離線查看,有幾個步驟。通過提取project檢查downloadBubble方法(node.js的)開始:

this.downloadBubble =function (urn, outPath) { 
    var self =this ; 
    self._outPath =outPath ; 
    return (new Promise (function (fulfill, reject) { 
     self._progress.msg ='Downloading manifest' ; 
     self.getManifest (urn) 
      .then (function (bubble) { 
       //utils.writeFile (outPath + 'bubble.json', bubble) ; 
       self._progress.msg ='Listing all derivative files' ; 
       self.listAllDerivativeFiles (bubble.body, function (error, result) { 
        self._progress._filesToFetch =result.list.length ; 
        console.log ('Number of files to fetch:', self._progress._filesToFetch) ; 
        self._progress._estimatedSize =0 | (result.totalSize/(1024 * 1024)) ; 
        console.log ('Estimated download size:', self._progress._estimatedSize, 'MB') ; 

        //self.fixFlatBubbles (result) ; 
        //self.fixFusionBubbles (result) ; 

        self._progress.msg ='Downloading derivative files' ; 
        self.downloadAllDerivativeFiles (result.list, self._outPath, function (failed, succeeded) { 
         //if (++self._done == 1 /*2*/) 
         // return ; 
         self.failed =failed ; 
         self.succeeded =succeeded ; 
         fulfill (self) ; 
        }) ; 
       }) ; 
      }) 
      .catch (function (err) { 
       console.error ('Error:', err.message) ; 
       self._errors.push (err.message) ; 
       reject (self) ; 
      }) 
     ; 
    })) ; 
} ; 

測試直播在https://extract.autodesk.io

+0

我使用你的幻想對象。很棒。謝謝。 –

3

urn應該是url編碼的,而不是base64編碼的。

相關問題