79217208

Date: 2024-11-23 05:35:00
Score: 1.5
Natty:
Report link

How to filter model views and retrieve data in the embedded Tandem Viewer?

After successfully initializing and starting the Autodesk Tandem Viewer, I can load and display the entire model. Based on a previous REST API call and user selection, I receive a twinId and a viewId.

Question 1: How can I display only the view (associated with the sViewId), not the entire model?

Question 2: How can I retrieve the data associated with the view (e.g., like the inventory table shown in the Tandem Viewer)?

Below is the relevant part of my current implementation:

displayFacility: function (sTwin, sViewId) {
  const app = this.oApp;
  return new Promise((resolve, reject) => {
    app.getCurrentTeamsFacilities()
      .then((facilitiesSharedWithMe) => {
        app.getUsersFacilities()
          .then((myFacilities) => {
            const aFacilities = [].concat(facilitiesSharedWithMe, myFacilities);
            const matchingFacility = aFacilities.find(facility => facility.twinId === sTwin);
            if (!matchingFacility) {
              const msg = `Facility with twinId '${sTwin}' not found.`;
              console.error(msg);
              reject(new Error(msg));
              return;
            }
            const currentFacility = app.displayFacility(matchingFacility, false, this.oViewer);
            resolve();
          });
      });
  });
}
Reasons:
  • Blacklisted phrase (0.5): How can I
  • Long answer (-1):
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • Self-answer (0.5):
  • Starts with a question (0.5): How to
  • Low reputation (1):
Posted by: Peter