autodesk-forgeautodesk-viewerautodesk-bim360tandemautodesk-tandem

Update view in Tandem viewer


i have created a tandem viewer in next js and fetched all the views in twin-models with

const data = await fetch(`https://developer.api.autodesk.com/tandem/v1/twins/${twinId}/views`, {
        headers: {
          Authorization: await this.getAuthHeader(),
        },
      }).then((response: any) => response.json());

but unable to update the view from the listing can anyone help.

I'm trying to update the view by selecting one of the view from the listing


Solution

  • to display specific saved view in the viewer you can use DtApp.views.setCurrentView method. For example following snippet shows how to set current view to the one named "Test":

    const views = await app.views.fetchFacilityViews(facility);
    const view = views.find(v => v.viewName === 'Test');
    
    if (view) {
      await app.views.setCurrentView(facility, view);
    }