Skip to content

Latest commit

 

History

History

forgesample

Quicker Configurator - ASP.NET Core

Platforms .NET License

oAuth2 Data-Management Design-Automation

Basic

Description

Webapp interface that uses Design Automation to update the parameters of the model that drives which components will be used in the assembly. Also includes a Clear Account (remove all AppBundles and Activities) and Define new Activity based on the sample code. Uses ASP.NET Core SignalR to update the interface.

See other projects for bundles.

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.

Live

https://forge-configurator.herokuapp.com/

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/adamenagy/QuickerAssemblerDA

ngrok

When a Workitem completes, Design Automation can notify our application. As the app is running locally (i.e. localhost), it's not reacheable from the internet. ngrok tool creates a temporary address that channels notifications to our localhost address.

After download ngrok, run ngrok http 3000 -host-header="localhost:3000", then copy the http address into the FORGE_WEBHOOK_URL environment variable (see next). For this sample, do not use the https address.

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 webapp folder (only), 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. 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_WEBHOOK_URL": "http://1234.ngrok.io",
    "FORGE_NICKNAME": "your app's nickname"
},

FORGE_NICKNAME: the nickname that you set for your APS app using the Design Automation's PATCH forgeapps/:id endpoint. If you have not done that, then use the same value as for FORGE_CLIENT_ID

How to use this sample

Open http://localhost:3000 to start the app, if first time, click on Define Activity, enter new parameter values, and click Start workitem.

Further Reading

Documentation:

Other APIs:

Tips & Tricks

This sample uses .NET Core and works fine on both Windows and MacOS, see this tutorial for MacOS. You still need Windows debug the AppBundle plugins.

Troubleshooting

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

Adam Nagy @adamthenagy, Developer Advocacy and Support