Search code examples
autodeskautodesk-forgeautodesk-viewer

Autodesk viewer offline - http-server communication to load and save files


We run the offline viewer using the http-server command, how can we make it load more files other than the bubbles and to be able to send strings back to it to save as files on the file system?

Do we have to write a modified http-server for that? if so can we have some direction on how?


Solution

  • The Viewer is read-only, nothing is saved or changed on the model after the translation.

    It's possible to get the current state, like zoom, perspective or position via Autodesk.Viewing.Viewer3D methods: getState() and restoreState(), but the state is not actually saved by default, you'll need to implement a JavaScript that communicate with your backend to POST and GET this information. This sample extends this state.

    Another sample extend this to save changes on model back to server that comunicate to the original file. Again, everything is custom implemented.

    In any case you'll need a back-end that store the changes and a JavaScript that read and restore it.