Note: For hosting this sample, you do not need any credentials. But anyone using the sample will need valid credentials for the upload /translation process. Visit the Forge WEB site for instructions to get on-board.
This sample exercises and demonstrates the Autodesk Forge API authorization, and translation process mentioned in the Quick Start guide. It provides you a quick way to get file ready for viewing on your own account without programming.
This sample is dependent of Node.js and few Node.js extensions which would update/install automatically via 'npm'.
- Node.js - built on Chrome's JavaScript runtime for easily building fast, scalable network applications. You can get Node.js from here
This sample is also dependent on the client side on couple of javascript library which are installed along this sample:
-
filedrop.js - A Self-contained cross-browser HTML5, legacy, AJAX, drag & drop JavaScript file upload, available here.
-
flipclock.js - A flip clock javascript library, available here.
-
zeroclipboard.js - A library which provides an easy way to copy text to the clipboard using an invisible Adobe Flash movie and a JavaScript interface, available here.
The sample was created using Node.js and javascript.
- Download and install Node.js (that will install npm as well)
- Download this repo anywhere you want (the server will need to write files, so make sure you install in a location where you have write permission, at least the 'uploads' folder)
- Execute 'npm install', this command will download and install the required node modules automatically for you.
npm install
- You are done for the setup, launch the node server using the command '[sudo] node start.js'.
sudo is required only on OSX and Linux.
- Windows
[set PORT=<port>] node start.js
- OSX/Linux
sudo [PORT=<port>] node start.js
Note: the port argument can be omitted and default to port 3000. If port 3000 is already in use by another application, you can use any other free port. But in the next section you would need to specify the port to use, i.e. http://localhost[:port]/ - Windows
Translating files
- Start your favorite browser supporting HTML5 and WEBGL and browse to http://localhost:3000/.
Note: In case you use a different port above do not forget to include it in the URL. I.e. http://localhost:8000/. - Drag'n Drop your files into the 'Drop area' or browse for individual files, That's it.
Or choose one of the proposed sample from the Dropbox and click on teh the 'Translate this one for me'. - After the translation completed successfully, you can copy the encoded urn string that you can use to view the results, in a html page which supports the Autodesk viewer.
- You are done with translation.
This sample is licensed under the terms of the MIT License. Please see the LICENSE file for full details.
Cyrille Fauvel
Forge Partner Development
http://developer.autodesk.com/
http://around-the-corner.typepad.com