3

I have a web project (React) using the Autodesk Forge Viewer to display 3D (& 2D) models from our Enterprise BIM360 account. Since last year, the same viewer running within BIM360 is now supporting .rcp files, we would like to allow it as well. But I couldnt make it to work so far, and I have not found any documentation specific to .rcp support.

My current viewer initialization is as follow. It's mostly standard code from documentation and it works fine with 3D models.

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. 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). it feels like Document.load() code only works for .svf format which has a manifest but .rcp don't?

Going through https://lmv.ninja.autodesk.com samples, I realized the .rcp files can be loaded using the following code:

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

However, it does not work with a private link from our BIM360 account. Looking at the network, I can see the requests returning with a 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. 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

  • As I know, RCP support is BIM360/ACC-only feature. But I'm checking with our engineering team. and will get back to you A.S.A.P. – Eason Kang Aug 18 '22 at 09:27

3 Answers3

2

Here is an update... Try using the iframe version of the Forge Viewer, like this...

STEPS:

  1. Take the raw BIM 360 / ACC URL Address, and extract out the ITEMS, PROJECTS & FOLDERS variables (see coloring used in the screenshot)
  2. in each of the variables, replace ':' character with '%3A'
  3. remove the 'b.' from the project variable
  4. Grab the ACCESSTOKEN from the tileset.json file Bearer Header (or use your own 3-legged system)
  5. Put the variables into this 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...

enter image description here

This is a workaround, until URN support is added (bubble decoder coming soon).

michael beale
  • 1,014
  • 1
  • 6
  • 5
  • Thanks for the follow up @michael. I got it to work fine when using a browser. However, it doesn't work when using an iframe (infinite loading spin). There is no errors in the console or the netw ork but I can see no request are made to `https://developer.api.autodesk.com/data/v1/` or `https://developer.api.autodesk.com/dm/v1/` (as opposed to the browser version). Is that expected? Also it looks like the 2leg auth isn't an option here, so it's not as convenient. Thanks – Clement Germain Sep 08 '22 at 21:51
  • Hi Clement - can you please vote on this answer. Also, if you would like the 2LO solution, then please contact me directly. (Since I can only provide some much complexity in my answers on stack-overflow). Also check out my Siggraph BOF and AU2022 talks on this topic. – michael beale Sep 10 '22 at 01:06
1

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. (What we call 'CAD vs Scan')

Are you only looking for 'scans' (points), or do you also need to see points (3D-Tiles) combined with triangles (SVF2) ?

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 | Unlocked Potential with Point Clouds and Forge - BES500831 90 min Technical instruction 9/28/22 (Wednesday) 11:00 AM PST

Feel free to reach out to me directly.

michael beale
  • 1,014
  • 1
  • 6
  • 5
  • Although you're saying the viewer cannot display both cad models and scans, I have been able to do that. For clarification, I mean using the js version to display cad OR scans. Not cad AND scans in the same instance. I can load a CAD private model by using `Autodesk.Viewing.Document.load()`, and a public scan by using `viewer.loadModel()`. I think the main issue is the bearer token provided during `Autodesk.Viewing.InitializerOptions` is not used by `viewer.loadModel`, hence the `401 (Unauthorized)`. When I run the rejected query in Postman with the token, it works fine. – Clement Germain Aug 24 '22 at 22:06
  • any update on the above? – Clement Germain Sep 01 '22 at 05:33
  • Hi Clement, That's an old sample file on lmv.ninja website, that shows some points (using an old experimental SVF1 point transport format). We abandoned that point-transport in favor for the streamable 3D-Tiles format. F.viewer can still render that file. However, you should try downloading the 3d-tiles from bim360 using this script: https://gist.github.com/wallabyway/4c7de696d96edc6b57725e21d0dea374 then use an external viewer like https://github.com/wallabyway/tiles3d-next-mapbox until we add F.Viewer support – michael beale Sep 05 '22 at 02:48
0

Sorry I missed this.

Here's an updated answer.

Forge (APS) Model Derivative Service can generate a 3D-Tiles point-cloud file set (tileset.json + 100's x .PNTS )given a single RCS file.

A Recap project file (RCP) is just an XML file, and doesn't get translated, but it guides translation of a folder containing lots of RCS files.

Once a 3D-Tile file set is created, it gets consumed by any standard 3D-Tiles decoder/viewer. ie. Cesium.js, deck.gl, etc.

BIM360/ACC flavor of Forge Viewer contains a cesium.js library, that decodes 3D-Tiles into the Three.js scene.

If you use stock Forge Viewer, you can decode 3D-Tiles using this custom 3D-Tiles extension I wrote.

First Example:

I use it to load 3D-Tiles directly from ACC/BIM360 here:

https://github.com/wallabyway/hub-browser-recap-ext

First, I uploaded an RCS file to my ACC Hub, wait for it to convert to 3D-Tiles, then click on the .RCS link in the left panel (see video). This tells the extension, where to find the 3D-Tiles tileset.json file (with an access token).

Second Example:

I have a 2nd example for Forge Buckets, slightly different. I upload the RCS file to a Forge Bucket, do a POST JOB to convert this to generate a 3D-Tiles file set.

I then consume the tileset.json and PNTS files directly from OSS, using a 2LO token.

Here it is: https://github.com/wallabyway/snowdontower-rvt-3dtiles-rcs-oss

Why - CAD vs Scan

The nice thing about these two repo examples, is that they combine CAD with Point-Scans. ie. they load SVF2 URNs (RVT/NWD/etc) and then add point-clouds (3D-Tiles) into the same scene.

The extension allows you to load in multiple tileset.json files. Effectively combining multiple RCS scans into the same scene.

michael beale
  • 1,014
  • 1
  • 6
  • 5
  • Note, in the demo, you need to click on a Revit file first, then click on any RCS files. LMV needs an SVF scene to get started. Then you can keep clicking on RCS files to keep adding more and more to the scene. – michael beale Jul 12 '23 at 02:24