0

Please have a look at my Autodesk Viewer extension

I am try to reload the Extension/Panel

My extension SmokeDetectorsExtension will load once when the viewer was loading the file. In my docking panel called SimplePanel I want to show some IOT sensors data. and this needs to be refreshed.

So is there a possiblity to unload and reload the whole extention?

can anyone help?

  • Welcome to Stack Overflow! I edited the title of your question to include the name of the function you're calling, so more people with knowledge of the subject will see it. Good luck! – Sean Wei Dec 11 '17 at 02:25

1 Answers1

0

Can you add a bit more details/context about the problem you are facing? The event Autodesk.Viewing.OBJECT_TREE_CREATED_EVENT is only fired once when the model gets loaded, so if you try to reload the extension after that event has been fired it will not work ...

You could store the instanceTree so if you reload the extension it is directly available, just an example:

if (this.instanceTree) {

     //...

} else {

    viewer.addEventListener(
        Autodesk.Viewing.OBJECT_TREE_CREATED_EVENT, function () {

            this.instanceTree = viewer.model.getData().instanceTree
            //... 
        } 
}
Felipe
  • 4,325
  • 1
  • 14
  • 19