This question is related to my previous question (How to implement a Forge Autodesk model-aggregating viewer? ). My current viewer is based on the http://learnforge.autodesk.io/#/ tutorial, and there's a part of the code I don't understand :
var options = {
env: 'AutodeskProduction',
getAccessToken: getForgeToken
};
var documentId = 'urn:' + urn;
console.log(documentId)
Autodesk.Viewing.Initializer(options, function onInitialized() {
viewerApp = new Autodesk.Viewing.ViewingApplication('forgeViewer');
viewerApp.registerViewer(viewerApp.k3D, Autodesk.Viewing.Private.GuiViewer3D);
viewerApp.loadDocument(documentId, onDocumentLoadSuccess, onDocumentLoadFailure);
});
The previous code, as far as I understood, initialize the viewer. However I don't figure out what kind of object viewerApp
is. Indeed :
Autodesk.Viewing.ViewingApplication
, so according to the documentation it should not have any specific method ( https://autodeskviewer.com/viewers/latest/docs/Autodesk.Viewing.ViewingApplication.html ).Autodesk.Viewing.Private.GuiViewer3D
so it should make sense if it calls the loadDocumentNode
method ( https://autodeskviewer.com/viewers/latest/docs/Autodesk.Viewing.Viewer3D.html#loadDocumentNode ), however it only calls loadDocument
, and I can't find this method in the documentation, plus I can't call other Autodesk.Viewing.Private.GuiViewer3D
methods.I'd recommend to refrain from using ViewingApplication
as it's being deprecated (albeit ployfill available for legacy support) in the upcoming Viewer v7.* (GTA next week).
Go with Autodesk.Viewing.Private.GuiViewer3D
or Autodesk.Viewing.Private.Viewer3D
and see here on how to initialize and load a model.
And see here for doc on AAutodesk.Viewing.Document.load
(equivalent to loadDocument
).