This repository demonstrates BIM 360 Field Issues API by a couple of scenarios: basic usage, export customized CSV, issues statistic and export DWG to PDF (create issue for failure job)
This repository demonstrates BIM 360 Field Issues API by a couple of scenarios:
- basic usage
- export issues list to customized CSV with comments list or with custom fields
- dashboard of issues statistics
- export DWG to PDF. Create issue for failure job. Send notification to specific Slack channel with the issue link
http://bim360-nodejs-issues-dashboard.herokuapp.com/
- BIM 360 Account: must be Account Admin to add the app integration. Learn about provisioning.
- Forge Account: Learn how to create a Forge Account, activate subscription and create an app at this tutorial.
- Node.js: basic knowledge with Node.js.
- JavaScript basic knowledge with jQuery
- Ngrok, in order to play with Demo 4 locally
- To play with sending message to Slack for [Demo 4], please create Slack app and generate post url by Slack tutorial
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/bim360-node.js-issues.api
Visual Sutdio Code (Windows, MacOS):
Open the folder, at the bottom-right, select Yes and Restore. This restores the packages (e.g. Autodesk.Forge) and creates the launch.json file. See Tips & Tricks for .NET Core on MacOS.
At the .vscode\launch.json
, find the env vars and add your Forge Client ID, Secret and callback URL.
To play with webhook for [Demo 4], take some tunnels tool such as ngrok to build the tunnel. e.g.
bash ngrok http 3000
Session Status online
Session Expires 7 hours, 42 minutes
Version 2.2.8
Region United States (us)
Web Interface http://127.0.0.1:4040
Forwarding http://694ccafe.ngrok.io -> localhost:3000
Forwarding https://694ccafe.ngrok.io -> localhost:3000
Connections ttl opn rt1 rt5 p50 p90
0 0 0.00 0.00 0.00 0.00
Also for [Demo 4],apply post message url of Slack, e.g. generate post url by Slack tutorial.
The end result should be as shown below:
"env": {
"FORGE_CLIENT_ID": "your id here",
"FORGE_CLIENT_SECRET": "your secret here",
"FORGE_CALLBACK_URL": "http://localhost:3000/api/forge/callback/oauth",
"FORGE_WEBHOOK_URL":"http://694ccafe.ngrok.io",
"SLACK_POST_MESSAGE_URL": "https://hooks.slack.com/services/<<XXXXX>>"
},
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:
npm install
node start.js
Open the browser: http://localhost:3000. And follow the thumbnail.gif to play the features.
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.
Watch this video on how deploy samples to Heroku.
- Select one project in the left panel tree.
- select one due date on the top of the issue tree. The issues at the specific due date will be listed.
- expand the attributes to check the values
- click pushpin attributes if it is not null. The corresponding model will be loaded and the issue pushpin will be added by Pushpin Extension
- fill in issue title and due date, click [create issue], one new issue will be created.
- select one issue in the issue tree, fill in comment body, and click [create comments], one new comment will be attached to the issue
- select one issue in the issue tree, select one local photo, then click [Attach Image]. after while, expand the node of attachments of the issue to check if the file is attached.
- Go to BIM 360 >> Field Management >> Issue tab to check if the new issue is created, check its attachments/comments.
- Select one project in the left panel tree.
- Check [Field Issue] or [Document Issue], tick [With Comments] or [With Custom Fields]
- click [Export]. an CSV will be generated note: currently, the sample has not implemeted Excel export. The button is for placing hold.
- Select one project in the left panel tree.
- The dashboard will be refreshed. Or click [Refesh] button to ask for refreshing
- select [due date] of [Number of Issues due at this week] will regenerate the view with those issues will due at specific week
In this demo, a custom activity of Forge Design Automation will be used to export DWG to PDF. To create such activity, follow the steps on Design Automation API help
A Postman scripts are available for creating. Input your Forge credential, get token, create dickname, create activity, create activity alias, and finally get all activities to check the final name. After the activity is ready, input the activity name to config file
- Select one project in the left panel tree.
- select source files folder in [Select Source Folder]
- select target files folder in [Select Target Folder]
- click [Batch Export]. All files will be exported by PDF action of AutoCAD Design Automation. IF any of them failed with the action, a log file will be uploaded to the target folder, and a Field issue will be created with the log as attachment note:
- Plan folder has special behavior with PDF files. So currently, please use other folders to test.
- if Slack webhook is delegated, a notification will be sent to Slack channel, click the link of Slack message, it will direct back to that issue of BIM 360.
Tutorials:
Blogs:
- Forge Blog
- Field of View, a BIM focused blog
- to make simple demo, this sample code does not use database to store the issue list. While in reality, it should be the administrator who can refresh the issue list. The refresh should be stored to a database.
- Cannot see my BIM 360 projects: Make sure to provision the Forge App Client ID within the BIM 360 Account, learn more here. This requires the Account Admin permission.
This sample is licensed under the terms of the MIT License. Please see the LICENSE file for full details.
Xiaodong Liang @coldwood, Forge Partner Development