Search code examples
autodesk-forgeautodesk-viewerautodesk

How to deactivate "Autodesk.VisualClusters" extension before unloading?


I am using the viewer.loadExtension and viewer.unloadExtension functions to load and unload the "Autodesk.VisualClusters" extension. But if the user has already activated the extension then unloading it directly causes some residual data to remain in the viewer.

residual data

How do I call the VisualClusters deactivate function? I tried getExtension() and then calling deactivate but it dosen't seem to be working.

props.viewer.getExtension("Autodesk.VisualClusters").setActive(); let unloadval = props.viewer.unloadExtension("Autodesk.VisualClusters");


Solution

  • You can reset the layout of the extension like so:

    viewer.getExtension('Autodesk.VisualClusters').reset();
    

    After that you can unload the extension as usual.