Search code examples
autodesk-forgeautodesk-viewer

How to only load main model on Autodesk Forge


I have two model: main model and linked model, be default when page's loaded, forge view will load a both that increase time load page, question is how to only load main model, i'm implemenning with reactjs. 1. Appreciate any comments.

enter image description here

I try using loadDocumentNode method but dont know how to get main model


Solution

  • Can you check if you have multiple 'views' inside the drawing?

    The 3D Model containing Main and Linked, is a single 'URN'. Inside the URN, there can be many Revit 'Views'. You can create Views of the Main, the Linked, a combination of the two, sectioned, individual floors, etc.

    Then, inside Forge Viewer (now Viewer SDK), you can pick one of these views. Pick a view that has a small amount of stuff in it, and it will load quickly.

    Here's the code for choosing a 'Revit View'...

    Example #1

    https://aps.autodesk.com/en/docs/viewer/v7/developers_guide/viewer_basics/load-a-model/

    var viewables = viewerDocument.getRoot().search({'type':'geometry'});
    viewer.loadDocumentNode(viewerDocument, viewables[0]);
    

    Example #2

    or from the 'Simple Viewer' Tutorial, here: https://tutorials.autodesk.io/tutorials/simple-viewer/viewer#viewer-logic

    function onDocumentLoadSuccess(doc) {
                resolve(viewer.loadDocumentNode(doc, doc.getRoot().getDefaultGeometry()));
            }
    

    on the Revit side, you can create views here: https://www.youtube.com/watch?v=SNivtnCIIbs

    and this blog post: https://segmentfault.com/a/1190000040960740/en

    Does that help ?