autodesk-forgeautodesk-viewerautodesk-bim360

Select particular 3d view to show in autodesk forge viewer


Is there a way to show and select from multiple 3d views using autodesk forge api which has already been uploaded to BIM 360 docs?


Solution

  • It is possible to show a BIM360 docs model on your WEB page. There is nice tutorial which shows you how to proceed - If your question is about showing multiple views on the same page, you will need to start 2 (or more) viewers and change the viewableID you want to see from the model. To do this, you will need the change the code to list and switch the viewableID.

    Tutorial code which loads views.

    // if a viewableId was specified, load that view, otherwise the default view
    var viewables = (viewableId ? doc.getRoot().findByGuid(viewableId) : doc.getRoot().getDefaultGeometry());
    

    doc.getRoot().getDefaultGeometry() will load the default view. The one which was active when you saved the original seed file.

    doc.getRoot().findByGuid(viewableId) - find a view based on its GUID. GUIDs can be retrieved from the manifest since all 3d and 2d views are listed in the model manifest.

    doc.getRoot().search({ role: '3d', type: 'geometry' }) will return a list of 3d views from the model (replace 3d by 2d for listing the 2D views)

    Note, you can load the Autodesk.DocumentBrowser extension to navigate to any views within the Viewer without coding.