Git Product home page Git Product logo

forge-civil3d-properties's Introduction

Extract style information - Civil 3D

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

Platforms .NET Civil 3D

Intermediate License

Description

This sample demonstrates using Design Automation with Civil 3D support included in the AutoCAD engine. User can select a DWG file hosted on BIM 360 Document Manager (or A360) and view using the Forge Viewer.

Once the file is loaded, in the background, a Design Automation workitem will run a .NET plugin to extract additional Style information from the file. When ready, the information will be visible on the property panel.

This sample is based on the Learn Forge tutorials (View hubs section).

Thumbnail

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 with C#
  4. ngrok: Routing tool, download here
  5. Civil 3D 2020: required to compile changes into the plugin. Windows only.

For using this sample, you need an Autodesk developer credentials. Visit the Forge Developer Portal, sign up for an account, then 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 on 2-legged flow. Finally take note of the Client ID and Client Secret.

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://git.autodesk.com/goncala/bim360civil

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"
},

Civil 3D plugin

A compiled version of the Civil 3D plugin (.bundles) is included on the webapp module, under wwwroot/bundles folder. Any changes on these plugins will require to create a new .bundle, the Post-build event should create it.

Start the app.

Open http://localhost:3000 to start the app, select a DWG 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, at 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 Partner Development

forge-civil3d-properties's People

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

forge-civil3d-properties's Issues

Command line of activity not up to date

From October 1, 2020, an activity definition requires argument and appbundles path variables be quoted. https://forge.autodesk.com/blog/design-automation-command-line

This sample does not reflect the update.
forgeSample/Controllers/DesignAutomation4Civil3D.cs L143 should be changed

from
string commandLine = string.Format(@"$(engine.path)\\accoreconsole.exe /i $(args[inputFile].path) /al $(appbundles[{0}].path) /s $(settings[script].path)", AppName);

to
string commandLine = string.Format(@"$(engine.path)\\accoreconsole.exe /i ""$(args[inputFile].path)"" /al ""$(appbundles[{0}].path)"" /s $(settings[script].path)", AppName);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.