Autodesk-Forge / forge-buckets-tools

Migrated to https://github.com/autodesk-platform-services/aps-buckets-tools
MIT License
21 stars 13 forks source link

OSS Manager

Node.js npm Platforms License

OAuth2 Design Automation

OSS stands for Object Storage Service which enables you to store your files on Forge and do further processing on them using other services like the Model Derivative Service

This utility app lets you to see and create new buckets on OSS, upload and download files, convert them to other formats, view them online and quesry meta data from them

Thumbnail

thumbnail

Live version

https://oss-manager.autodesk.io

Usage

The first time you use this app with the credentials of a given Forge app, it will generate all the neccessary app bundles and activities:

thumbnail

If app bundles and activities with the specific names already exist for the given Forge app then they will not be overwritten with the correct ones. The best thing is to create a new Forge app and use its credentials with this sample app.

  1. On the top you can provide your Forge app's Client Id and Client Secret to use for authentication\ It also has a Progress Info field where information about the progress of the translation or any other warnings or successes will be displayed\ When you right-click a file then apart from being able to delete it or download it, you can also generate a read/write publicly accessible URL for it \ This can come very handy when working with other services that require such URLs in order to provide input/output to them, like the Design Automation Service

thumbnail

  1. On the left side you'll find all the OSS related functionality: listing all your buckets and files, creating new buckets, uploading/downloading files \ When translating to the OBJ format then what will be included in that file depends on the object selection in the Hieararchy Tree (if no object is selected then the whole file will be translated) - all other translations will translate the whole file no matter which objects are selected

  2. In the center you'll find all the Model Derivative functionality: showing the hierarchy of objects inside the file, providing translations available for the given file, and showing meta data for selected component \ Using the Delete button you can delete the current manifest of the file - it can be useful if the translation failed for a given file and you want to try it again (maybe in the meantime you also uploaded a new version of the file under the same name so you do need a new translatoin)

  3. On the right side you'll find the Forge Viewer that will display the model in its default format: may that be 2D or 3D

Setup

Prerequisites

  1. Forge Account: Learn how to create a Forge Account, activate subscription and create an app at this tutorial.
  2. Visual Studio: Either Community (Windows) or Code (Windows, MacOS).
  3. JavaScript basic knowledge with jQuery

Run locally

Install NodeJS.

Clone this project or download it. It's recommended to install GitHub desktop. To clone it via command line, use the following (Terminal on MacOSX/Linux, Git Shell on Windows):

git clone https://github.com/Autodesk-Forge/forge-buckets-tools

To run it, install the required packages, set the enviroment variables with your client ID & secret and finally start it. Via command line, navigate to the folder where this repository was cloned and use the following:

Mac OSX/Linux (Terminal) / Windows (use Node.js command line from Start menu)

npm install
npm start

Open the browser: http://localhost:3000.

Important: when testing locally, comment out the app.use(enforce.HTTPS({ trustProtoHeader: true })); line in the server.js file before running the app, since we won't be using HTTPS, only HTTP

Deployment

To deploy this application to Heroku, the Callback URL for Forge must use your .herokuapp.com address. After clicking on the button below, at the Heroku Create New App page, set your Client ID, Secret and Callback URL for Forge.

Deploy

Watch this video on how deploy samples to Heroku.

Packages used

All Autodesk Forge NPM packages are included by default, see complete list of what's available at NPM website. OAuth, Model Derivative and OSS are used. Some other non-Autodesk packaged are used, including express and its session/cookie middlewares (express-session and cookie-parser) for user session handling. The front-end uses bootsrap and jquery.

Tips & tricks

For local development/testing, consider use nodemon package, which auto restart your node application after any modification on your code. To install it, use:

sudo npm install -g nodemon

Then, instead of npm run dev, use the following:

npm run nodemon

Which executes nodemon server.js --ignore www/, where the --ignore parameter indicates that the app should not restart if files under www folder are modified.

Further Reading

Documentation:

Tutorials:

Blogs:

License

This sample is licensed under the terms of the MIT License. Please see the LICENSE file for full details.

Written by

Adam Nagy (Forge Partner Development)
http://forge.autodesk.com