Autodesk-Forge / viewer-javascript-offline.sample

Offline viewing: Use the viewer to run local files
http://autodesk-forge.github.io/viewer-javascript-offline.sample/
MIT License
105 stars 32 forks source link
javascript viewer

Offline viewing sample for Autodesk Viewer

Viewer

Description

This repository demonstrates a self-contained Forge Viewer application, with all the necessary dependencies and resources hosted on your own server, independent of any Forge API endpoints.

Use cases of hosting the entirety of a Viewer application like this sample on your own instance include:

Live Demo

Setup

To replace the model (in extracted format .svf) to be viewed, change the value of document in index.html.

var options = {
    'document' : './shaver/0.svf',
    'env':'Local'
    };

Run with Python: to start this application with Python 2.x, run below in the directory of your local clone:

python -m SimpleHTTPServer 8000

Run with NodeJS: to start this application with NodeJS 5+, run below in the directory of your local clone:

npx http-server -p 8000

Alternatively feel free to spin this sample up with your favorite web server (IIS/Kestrel/Tomcat/Apache/Nginx etc.) as it's 100% static.

Navigate to http://localhost:8000 on Chrome/Firefox/IE 11+/Safari/Opera to see the result.

Tips and Tricks

To view other models, replace value of 'document' of 'options' with the url below:

Shaver

http://developer-autodesk.github.io/translated-models/shaver/0.svf

House

http://developer-autodesk.github.io/translated-models/dwfx-sample-house/f0224dd3-8767-45c1-ff99-5c9c881b9fee/0.svf

thumbnail

You can also download those translated models from this GitHub repo.

You can translate your own models at extract.autodesk.io.

Written By

Shiya Luo & Bryan Huang

Thumbnail

Thumbnail