After leaving my Autodesk extension alone for a few weeks, my initialization code is failing to create a ViewingApplication.
In my browser's js console, I can see that the Autodesk.Viewing object contains many objects, but it no longer contains any ViewingApplication. The Viewer API documentation still includes ViewingApplication.
Autodesk.Viewing.Initializer(options, function onInitialized(){
viewerApp = new Autodesk.Viewing.ViewingApplication('MyViewerDiv');
var config3d = {
extensions: ['WharfExtension']
};
viewerApp.registerViewer(viewerApp.k3D, Autodesk.Viewing.Private.GuiViewer3D, config3d);
var model = 'urn:' + defaultModel;
viewerApp.loadDocument(model, onDocumentLoadSuccess, onDocumentLoadFailure);
});
My browser says, "Uncaught TypeError: Autodesk.Viewing.ViewingApplication is not a constructor," and I am inclined to agree?
EDIT: It works as expected from my coworker's machine, so apparently it is not a problem with the API. I am serving the page from a web server on my machine.
EDIT2: Solved. Thanks, Petr. I was including the new, non-backwards-compatible version of the API without realizing it. Autodesk describes how to create this behavior in the new version in their Migration Guide v6 to v7.