This code is derived from a sample that is part of the Learn Forge tutorials. It has been modified by our team, 134stillAlive for Smarthack 2020. We participated as contestants for Autodesk, with the theme "How could we use cloud computing in BIM to help your city develop into a smart city?".
Our solution is an app aims to load a model while using sensors connected to a server. You can use the GUI then to join the elements in the viewer with the sensors, and monitor the data that the server receives. The changes are reflected in a graph, and in the viewer (the elements color changes according to the data received from the joined sensor). This is just a demo, and it simulates the data using random values, but in a real world scenario this setup can be used for monitoring many parameters (water, electricity, waste management).
To use this sample, you will need Autodesk developer credentials. Visit the Forge Developer Portal, sign up for an account, then create an app. For this new app, use http://localhost:3000/api/forge/callback/oauth as the Callback URL, although it is not used on a 2-legged flow. Finally, take note of the Client ID and Client Secret.
Install NodeJS.
Clone to project, install the required packages, and modify the code with your cliend ID and client secret. Also, you may want to change the URN so the viewer will render a different file (the file needs to be translated before it can be used in the application, for this see the Autodesk Model Derivative API).
npm install
npm start
Open the browser: http://localhost:3000.
This sample is licensed under the terms of the MIT License. Please see the LICENSE file for full details.
Augusto Goncalves @augustomaia, Forge Partner Development
The original code was a sample from Autodesk Learn Forge, that was modified by the 134stillAlive team for Smarthack 2020.