autodesk-forgeautodesk-viewer

How to load an external extension in the viewer


I'm trying to load the following extension on the viewer but I still see the defaut extensions.

https://github.com/wallabyway/forge-markup-measure-extensions

I have build the files (Measure.min.js and Markup.min.js), after that I place them inside my ./src folder and add the following code to my index.html file :

<script src="./Measure.min.js"></script> 

The Measure.min.js file is inside my public folder. It does not work. What I'm missing here ?


Solution

  • You need to load the extension this way:

    viewer.loadExtension('Autodesk.Measure')
    

    https://github.com/wallabyway/forge-markup-measure-extensions/blob/master/Measure/Measure.js#L989