Skip to content

Latest commit

 

History

History
178 lines (123 loc) · 9.73 KB

README.md

File metadata and controls

178 lines (123 loc) · 9.73 KB

bim360-node.js-issues.api

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)

node npm visual code

oAuth2 Data-Management Viewer

BIM-360 Design Automation

License Level

Description

This repository demonstrates BIM 360 Field Issues API by a couple of scenarios:

  1. basic usage
  2. export issues list to customized CSV with comments list or with custom fields
  3. dashboard of issues statistics
  4. export DWG to PDF. Create issue for failure job. Send notification to specific Slack channel with the issue link

Thumbnail

thumbnail

Live version

http://bim360-nodejs-issues-dashboard.herokuapp.com/

Setup

Prerequisites

  1. BIM 360 Account: must be Account Admin to add the app integration. Learn about provisioning.
  2. Forge Account: Learn how to create a Forge Account, activate subscription and create an app at this tutorial.
  3. Node.js: basic knowledge with Node.js.
  4. JavaScript basic knowledge with jQuery
  5. Ngrok, in order to play with Demo 4 locally
  6. To play with sending message to Slack for [Demo 4], please create Slack app and generate post url by Slack tutorial

Running locally

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.

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.

Demonstrations

Demo 1: Basic Usage of Issue API

  1. Select one project in the left panel tree.
  2. select one due date on the top of the issue tree. The issues at the specific due date will be listed.
  3. expand the attributes to check the values
  4. click pushpin attributes if it is not null. The corresponding model will be loaded and the issue pushpin will be added by Pushpin Extension
  5. fill in issue title and due date, click [create issue], one new issue will be created.
  6. select one issue in the issue tree, fill in comment body, and click [create comments], one new comment will be attached to the issue
  7. 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.
  8. Go to BIM 360 >> Field Management >> Issue tab to check if the new issue is created, check its attachments/comments.

thumbnail

Demo 2: Export Customized CSV

  1. Select one project in the left panel tree.
  2. Check [Field Issue] or [Document Issue], tick [With Comments] or [With Custom Fields]
  3. click [Export]. an CSV will be generated note: currently, the sample has not implemeted Excel export. The button is for placing hold.

thumbnail

Demo 3: Dashboards of Issues Statistic

  1. Select one project in the left panel tree.
  2. The dashboard will be refreshed. Or click [Refesh] button to ask for refreshing
  3. select [due date] of [Number of Issues due at this week] will regenerate the view with those issues will due at specific week thumbnail

Demo 4: Export DWG to PDF (create issue with failure job)

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

  1. Select one project in the left panel tree.
  2. select source files folder in [Select Source Folder]
  3. select target files folder in [Select Target Folder]
  4. 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.
  1. 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.

thumbnail

Further Reading

Tutorials:

Blogs:

Tips & Tricks

  1. 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.

Troubleshooting

  1. 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.

License

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

Written by

Xiaodong Liang @coldwood, Forge Partner Development