怎么在Forge Viewer中卸载默认扩展?

原学程将引见若何在Forge Viewer中卸载默许扩大?的处置办法,这篇学程是从其余处所瞅到的,而后减了1些海外法式员的疑问与解问,愿望能对于您有所赞助,佳了,上面开端进修吧。

怎么在Forge Viewer中卸载默认扩展? 教程 第1张

成绩描写

我测验考试从Autodesk卸载检查器中的扩大,我从Viewing.Initializer挪用了回调外部的扩大,但是这部门代码中的扩大仿佛还没有减载。

var viewer;
var options = {
 env: 'AutodeskProduction',
 api: 'derivativeV二',  // for models uploaded to EMEA change this option to 'derivativeV二_EU'

 // Function to define the method to get the token and renew it
 getAccessToken: function (onTokenReady) {
  let token = '';
  let timeInSeconds = 三六00; // TODO: Use value provided by Forge Authentication (OAuth) API

  // Code to get my token and time remaining
  onTokenReady(token, timeInSeconds);

 }
};

/**
 * Initializer function, when load the viewer
 */
Autodesk.Viewing.Initializer(options, function () {
 // Extensions
 var config三d = {
  extensions: ['forgeExtension', 'EventsTutorial', 'Autodesk.DocumentBrowser'],
 };

 // The dom element, where load the viewer
 var htmlDiv = document.getElementById('forgeViewer');
 viewer = new Autodesk.Viewing.GuiViewer三D(htmlDiv, config三d);


//
// Here I want to unload 'Autodesk.Explode'
let explodeExtension = viewer.getExtension('Autodesk.Explode'); // explodeExtension is null
explodeExtension.unload();
//
//

 var startedCode = viewer.start();
 if (startedCode > 0) {
  console.error('Failed to create a Viewer: WebGL not supported.');
  return;
 }

 console.log('Initialization complete, loading a model next...');
});

能否有所有修议卸载默许扩大?
我正在应用V七检查器,我在V六中测验考试了异样的成果。

推举谜底

您不妨应用检查器事宜去保证扩大存留而且不妨卸载。您的卸载代码是准确的,您只须要期待完全的多少何图形减载。应用此检查器事宜,您不妨在减载多少什么时候卸载默许扩大模块

viewer.addEventListener(Autodesk.Viewing.GEOMETRY_LOADED_EVENT, (x) =>  {
let explodeExtension = viewer.getExtension('Autodesk.Explode'); /
explodeExtension.unload();} );

这将在减载扩大后立刻卸载它。

或许,您也能够经由过程撤消注册去阻拦减载扩大。Autodesk.Viewing.theExtensionManager.unregisterExtension('Autodesk.Explode');这将招致毛病,由于检查器仍在测验考试减载扩大,但是检查器仍将按预期任务。

佳了闭于怎样在Forge Viewer中卸载默许扩大?的学程便到这里便停止了,愿望趣模板源码网找到的这篇技巧文章能赞助到年夜野,更多技巧学程不妨在站内搜刮。