Search code examples
autodesk-forgeautodesk-viewerautodesk-model-derivative

Autodesk Forge load multiple URNs translated from the multiple users


I have Viewer created by using my access token but I want to load the models (urns) translated come from the other users. Is it possible ? Thank in advance


Solution

  • ok, so three part answer:

    1. For multi model loading, inside Forge Viewer, follow this guide: https://aps.autodesk.com/blog/loading-multiple-models-forge-viewer-v7

    2. Multi model loading can only use 1 Access Token.

    3. If the other models were translated by other people, and the files live on ACC/BIM 360 storage, then ask for permission to be added to those projects. Then, when you generate a 3-legged token as per the Hubs Browser Tutorial, your token will have permission to access files translated by other people.

    For #2, you could try this trick. Try changing the AccessToken, after each load has fully completed, by overriding the built-in token, used by LMV's Fetch command here:

    ie.

    Autodesk.Viewing.Private.token.accessToken = "token-user1"
    await loadModel(URN_user1_Model);
    await sleep(5000);
    
    Autodesk.Viewing.Private.token.accessToken = "token-user2"
    await loadModel(URN_user2_Model);
    await sleep(5000);
    
    Autodesk.Viewing.Private.token.accessToken = "token-user3"
    await loadModel(URN_user3_Model);
    

    It's not guaranteed to work, but you can try.