autodesk-viewerautodeskforge

APS DataViz Extensions Demo: I got an error "The file extension loaded in the viewer is not supproted."


Error message when loading the file

I tried replicating this: https://github.com/autodesk-platform-services/aps-iot-extensions-demo

But when I enter my APS_MODEL_VIEW ID in the config, I got an error stating: “The File Extension Loaded into the viewer is not supported. Try a different file.”

I tried leaving the APS_MODEL_VIEW empty, but as a result, the sensors would not appear.

Anyone experienced this before?

I tried leaving the APS_MODEL_VIEW empty, but as a result, the sensors would not appear.


Solution

  • The implementation of aps-iot-extension-demo sample doens't support empty view-id. If you want to do so, please change viewer.js a little bit like the one below.

    export function loadModel(viewer, urn, guid) {
        return new Promise(function (resolve, reject) {
            function onDocumentLoadSuccess(doc) {
                const viewable = guid ? doc.getRoot().findByGuid(guid) : doc.getRoot().getDefaultGeometry(true); //!<<< the `getDefaultGeometry(true)` will load first master view the viewer finds.
                resolve(viewer.loadDocumentNode(doc, viewable));
            }
            function onDocumentLoadFailure(code, message, errors) {
                reject({ code, message, errors });
            }
            Autodesk.Viewing.Document.load('urn:' + urn, onDocumentLoadSuccess, onDocumentLoadFailure);
        });
    }
    

    See: https://github.com/autodesk-platform-services/aps-iot-extensions-demo/issues/6 and https://gist.github.com/salahelfarissi/784796c339ea39ec917f919db6f203fc