简体   繁体   English

如何让 Autodesk Forge Viewer 支持.rcp 文件

[英]How to get Autodesk Forge Viewer to support .rcp files

I have a web project (React) using the Autodesk Forge Viewer to display 3D (& 2D) models from our Enterprise BIM360 account.我有一个 web 项目(React),它使用 Autodesk Forge 查看器显示来自我们的 Enterprise BIM360 帐户的 3D(和 2D)模型。 Since last year, the same viewer running within BIM360 is now supporting .rcp files, we would like to allow it as well.自去年以来,在 BIM360 中运行的同一个查看器现在支持.rcp文件,我们也希望允许它。 But I couldnt make it to work so far, and I have not found any documentation specific to .rcp support.但是到目前为止我还不能让它工作,而且我还没有找到任何特定于.rcp支持的文档。

My current viewer initialization is as follow.我当前的查看器初始化如下。 It's mostly standard code from documentation and it works fine with 3D models.它主要是文档中的标准代码,它适用于 3D 模型。

const options: Autodesk.Viewing.InitializerOptions = {
   getAccessToken: (callback) => callback(token.accessToken, token.expiresIn),
   loaderExtensions: { svf: "Autodesk.MemoryLimited" }
};
 
Autodesk.Viewing.Initializer(options, () => {
   const viewer = new Autodesk.Viewing.GuiViewer3D(ref.current);

   var startedCode = viewerObject.start();
   if (startedCode > 0) {
      onError('Error - Failed to create a Viewer: WebGL not supported.');
      return;
   }

   //urn is Base64
   Autodesk.Viewing.Document.load(urn, onDocumentLoadSuccess, onDocumentLoadError);
});

I naively tried to give it the Base34 urn of an .rcp file without success.我天真地试图给它一个.rcp文件的 Base34 骨灰盒,但没有成功。 Looking at the network, I can see a 400 Bad Request on a manifest request ( https://cdn.derivative.autodesk.com/derivativeservice/v2/manifest/{urn}?domain=http%3A%2F%2Flocalhost%3A6006 ).查看网络,我可以在清单请求中看到400 Bad Request ( https://cdn.derivative.autodesk.com/derivativeservice/v2/manifest/{urn}?domain=http%3A%2F%2Flocalhost%3A6006 )。 it feels like Document.load() code only works for .svf format which has a manifest but .rcp don't?感觉Document.load()代码仅适用于具有清单但.rcp没有的.svf格式?

Going through https://lmv.ninja.autodesk.com samples, I realized the .rcp files can be loaded using the following code:通过https://lmv.ninja.autodesk.com示例,我意识到可以使用以下代码加载.rcp文件:

viewer.loadModel(url, {}, onModalLoadSuccess,onModelLoadError);
viewer.loadExtension('Autodesk.ReCap')

which I got to work with the sample file: https://s3.amazonaws.com/lmv.models/recap_models/AutodeskReCapSampleProject.rcp我必须使用示例文件: https://s3.amazonaws.com/lmv.models/recap_models/AutodeskReCapSampleProject.rcp

However, it does not work with a private link from our BIM360 account.但是,它不适用于我们 BIM360 帐户中的私人链接。 Looking at the network, I can see the requests returning with a 401 Unauthorized .查看网络,我可以看到请求返回401 Unauthorized Sadly my access token is not added to the headers.遗憾的是,我的访问令牌没有添加到标题中。 A bug?一个错误? Or am I missing something?还是我错过了什么?

POST https://developer.api.autodesk.com/oss/v2/buckets/wip.dm.prod/objects/{guid}.rcp
401 Unauthorized
{ 
   "developerMessage":"Token is not provided in the request.", 
   "moreInfo": "https://forge.autodesk.com/en/docs/oauth/v2/developers_guide/error_handling/", 
   "errorCode": "AUTH-010"
}

I tried to see how lmv.ninja would do it from a BIM360 model but I can't go through the login step.我试图通过登录步骤查看 lmv.ninja 如何从 BIM360 model 执行此操作,但我无法通过 go 进行操作。 It keep redirect me to the default page without logging me in. Clearly looks like another bug to me.它不断将我重定向到默认页面而无需登录。显然对我来说似乎是另一个错误。

Note: I have updated the viewer library to latest注意:我已将查看器库更新为最新

https://autodeskviewer.com/viewers/latest/viewer3D.min.js
https://autodeskviewer.com/viewers/latest/extensions/ReCap/ReCap.min.js
https://autodeskviewer.com/viewers/latest/lmvworker.min.js

Thanks for the help谢谢您的帮助

Clement克莱门特

Actually, the Forge Viewer used to display point-cloud 3D-Tiles, is a fork version of the Forge Viewer, and it's not able to display both CAD model triangles, with 3D-Tiles point-cloud, currently.实际上,用于显示点云 3D-Tiles 的 Forge Viewer 是 Forge Viewer 的 fork 版本,目前无法同时显示 CAD model 三角形和 3D-Tiles 点云。 (What we call 'CAD vs Scan') (我们称之为“CAD 与扫描”)

Are you only looking for 'scans' (points), or do you also need to see points (3D-Tiles) combined with triangles (SVF2)?您只是在寻找“扫描”(点),还是还需要查看结合三角形(SVF2)的点(3D-Tiles)?

These RCP workflows are a 'work in progress' and I hope to share updates on that topic, during Autodesk University, in the Point-Cloud talk: BES500831 |这些 RCP 工作流程是“正在进行中的工作”,我希望在 Autodesk 大学期间的点云演讲中分享有关该主题的更新:BES500831 | Unlocked Potential with Point Clouds and Forge - BES500831 90 min Technical instruction 9/28/22 (Wednesday) 11:00 AM PST用点云和 Forge 解锁潜力 - BES500831 90 分钟 技术指导 22 年 9 月 28 日(星期三)太平洋标准时间上午 11:00

Feel free to reach out to me directly.请随时直接与我联系。

Here is an update... Try using the iframe version of the Forge Viewer, like this...这是更新...尝试使用 Forge Viewer 的 iframe 版本,像这样...

STEPS:脚步:

  1. Take the raw BIM 360 / ACC URL Address, and extract out the ITEMS, PROJECTS & FOLDERS variables (see coloring used in the screenshot)获取原始 BIM 360 / ACC URL 地址,并提取项目、项目和文件夹变量(参见屏幕截图中使用的颜色)
  2. in each of the variables, replace ':' character with '%3A'在每个变量中,将 ':' 字符替换为 '%3A'
  3. remove the 'b.'删除“b”。 from the project variable从项目变量
  4. Grab the ACCESSTOKEN from the tileset.json file Bearer Header (or use your own 3-legged system)从tileset.json文件中获取ACCESSTOKEN Bearer Header(或使用您自己的三足系统)
  5. Put the variables into this URL:将变量放入这个 URL 中:
https://cdn.recap.autodesk.com/viewer/latest/index.html?file={$ITEMS}&pid=${PROJECTS}&fid=${FOLDERS}&env=prd&src=bim360&accessToken=${ACCESSTOKEN}

here's an example, with the variables populated:这是一个示例,其中填充了变量:

BIM 360 URL:
https://docs.b360.autodesk.com/projects/37cf25af-1304-4c2b-b54f-0c98ed8a42e0/folders/urn:adsk.wipprod:fs.folder:co.AtLas5d8T_eWl2SzFB5pSg/detail/viewer/items/urn:adsk.wipprod:dm.lineage:tYiwN_yMTDmj5jroyTCwBQ

IFRAME URL:
https://cdn.recap.autodesk.com/viewer/latest/index.html?file=urn%3Aadsk.wipprod%3Adm.lineage%3AtYiwN_yMTDmj5jroyTCwBQ&pid=37cf25af-1304-4c2b-b54f-0c98ed8a42e0&fid=urn%3Aadsk.wipprod%3Afs.folder%3Aco.AtLas5d8T_eWl2SzFB5pSg&env=prd&src=bim360&accessToken=eyJhbGciO...etc 

Then put this iFrame URL into a browser, and the Recap viewer will load with your point cloud, like this screenshot...然后将此 iFrame URL 放入浏览器,Recap 查看器将加载您的点云,就像这个屏幕截图...

在此处输入图像描述

This is a workaround, until URN support is added (bubble decoder coming soon).这是一种解决方法,直到添加 URN 支持(气泡解码器即将推出)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM