Skip to content

Extract Compound Structure Layer for RVT files using Design Automation for Revit

Notifications You must be signed in to change notification settings

augustogoncalves/forge-customproperty-revit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Extract Compound Layer information with Revit engine

Platforms .NET Core ASP.NET Core oAuth2 Data-Management Design-Automation

Platforms .NET Revit

Intermediate License

Description

This sample demonstrates using the Forge Design Automation for Revit API to extract additional information from a model. The user can select a RVT file hosted on BIM 360 Document Manager or A360 and view it using the Forge Viewer.

Once the file has been loaded, a Design Automation workitem will run a .NET plugin in the background to extract Compound Layer Structure information from the file. When ready, the information will be visible in the property panel.

This sample is based on the Learn Forge tutorials in the section List hubs & projects.

Thumbnail

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. .NET Core: basic knowledge of C#.
  4. ngrok: Routing tool, download here.
  5. Revit 2020: required to compile changes into the plugin. Windows only.

Use of this sample requires Autodesk developer credentials. Visit the Forge Developer Portal, sign up for an account and create an app that uses Data Management and Model Derivative APIs. For this new app, use http://localhost:3000/api/forge/callback/oauth as Callback URL, although is not used in a 2-legged flow. Finally, make a note of the Client ID and Client Secret.

Running locally

Clone this project or download it. We recommend installing GitHub desktop. To clone it via command line, use the following (Terminal on MacOSX/Linux, Git Shell on Windows):

git clone https://github.com/augustogoncalves/forge-customproperty-revit

Visual Studio (Windows):

Right-click on the project, then go to Debug. Adjust the settings as shown below.

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.

ngrok

Run ngrok http 3000 -host-header="localhost:3000" to create a tunnel to your local machine, then copy the address into the FORGE_WEBHOOK_URL environment variable.

Environment variables

At the .vscode\launch.json, find the env vars and add your Forge Client ID, Secret and callback URL. Also define the ASPNETCORE_URLS variable. The end result should be as shown below:

"env": {
    "ASPNETCORE_ENVIRONMENT": "Development",
    "ASPNETCORE_URLS" : "http://localhost:3000",
    "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": "your ngrok address here: e.g. http://abcd1234.ngrok.io"
},

Revit plugin

A compiled version of the Revit plugin (.bundles) is included on the webapp module in the wwwroot/bundles folder. Any changes to these plugins will require the creation of a new .bundle; the Post-build event should handle that.

Start the app.

Open http://localhost:3000 to start the app and select a RVT file. A pop-up will indicate when the style information is ready.

Deployment

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

Deploy

Further Reading

Documentation:

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.

  2. error setting certificate verify locations error: may happen on Windows, use the following: git config --global http.sslverify "false"

License

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

Written by

Augusto Goncalves @augustomaia, Forge Advocate

About

Extract Compound Structure Layer for RVT files using Design Automation for Revit

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages