Demo application showcasing Configuration with Design Automation for Inventor
- .NET Core 3.1
- Node.js
- (recommended) Visual Studio Code with extensions:
- Debugger for Chrome (for debugging client side code)
- ESLint
- Prettier
- psioniq File Header (to insert copyright header)
- Autodesk Inventor 2021
- Visual Studio 2019
- Clone repository
- Create a forge app at https://forge.autodesk.com/, and select the
Design Automation API
andData Management API
APIs - Enter https://localhost:5001 as the callback URL.
- Note the Client ID and Secret generated.
- Specify forge credentials.
- Copy
AppBundles\InventorBinFolder.props.template
toAppBundles\InventorBinFolder.props
- Replace the
PATH_TO_YOUR_INVENTOR_BIN
string in theAppBundles\InventorBinFolder.props
file with your actual Inventor bin folder path, for example:C:\Program Files\Autodesk\Inventor 2021\Bin
- (Optional) Specify if access should be limited in
WebApplication\appsettings.json
. SetEnabled
totrue
orfalse
, and populate theDomains
andAddresses
fields with comma delimited lists such as["autodesk.com", "company.com"]
and["person@company2.com", "person@company3.com"]
.
- Building the projects also installs required packages (this can take several minutes).
- Open the
forge-configurator-inventor.sln
file with Visual Studio 2019 and build the solution.
- From a command prompt, go to the
WebApplication
directory, and rundotnet build
.
- Create initial data: from the
WebApplication
directory, rundotnet run initialize=true
- Clear data: from the
WebApplication
directory, rundotnet run clear=true
- Clear and then load initial data: from the
WebApplication
directory, rundotnet run initialize=true clear=true
- When the app finishes the initialization process it remains running and expects client calls. You can leave it running and follow by opening the site or stop it and move to the the Debugging section
- From a command prompt, go to the
WebApplication
directory, and rundotnet run
- Navigate to https://localhost:5001
- You may need to refresh the browser after it launches if you see the error
This site can't be reached
- If you see the error
Your Connection is not private
, clickAdvanced
and thenProceed to localhost (unsafe)
. This is due a development certificate being used.
- You may need to refresh the browser after it launches if you see the error
- Make sure that application is fully initialized, before you start debugging session. Please see the Clear and load initial data
- Open the repository root folder in VS Code
- In the Run tab, select the
Server/Client
configuration and click the "Start Debugging" (arrow) button- Some browser errors are normal, see open site
- Disregard C# errors related to AppBundles in VS Code
- Note that running the tests clears initialization data, so you will either need to change forge credentials before running them, or run the initializer again afterward. See Clear and load initial data...
- From Visual Studio 2019
- Open Test Explorer and select tests to run or debug
- From Visual Studio Code
- Open a test file in the
WebApplication.Tests
directory and click on eitherRun Test
orDebug Test
above one of the methods decorated with the[Fact]
attribute. Or, above the class declaration click on eitherRun All Tests
orDebug All Tests
- Open a test file in the
- From the command line, in either the root or
WebApplication.Tests
directory rundotnet test
- In Visual Studio Code, on the Run tab, select the
Debug Jest All
configuration and click the "Start Debugging" (arrow) button- Note that once you run the tests they will only run again if they changed since the last time
- Alternatively, using the command line go to WebApplication/ClientApp and execute
npm test
- For UI tests we are using
CodeCeptJs
framework. All tests are stored inClientApp/src/ui-tests/
and we filter all files end with*_test.js
. - Set environment variables
SDRA_USERNAME
andSDRA_PASSWORD
forSign-in
workflow. We are using Autodesk Account credentials forSign-in
.- Also you can create a
.env
file in theWebApplication/ClientApp
directory to define the environment variables - for more details follow this link: https://www.npmjs.com/package/dotenv
- Also you can create a
- Note that the server needs to be running for these tests
- From the
WebApplication/ClientApp
directory:- For all UI tests Run this command:
npx codeceptjs run
ornpm run uitest
. - For particular file you can use this command:
npx codeceptjs run src/ui-tests/<test file name>
- For all UI tests Run this command:
Use one of the following approaches:
- Set environment variables
FORGE_CLIENT_ID
andFORGE_CLIENT_SECRET
. - Create
appsettings.Local.json
in theWebApplication
directory and use the following as its content template:
{
"Forge": {
"clientId": "<YOUR CLIENT ID>",
"clientSecret": "<YOUR CLIENT SECRET>"
}
}
- Set environment variables
Forge__ClientId
andForge__ClientSecret
. - (not on dev machine) Modify
appsettings.json
(orappsettings.<ENVIRONMENT>.json
) with the template above.
We are using the forge service on the backend https://forge.autodesk.com/
We are using the latest version of .NET Core (3.1 at the time of writing) https://dotnet.microsoft.com/download/dotnet-core/3.1
The project was initally created using the command dotnet new react
https://forge.autodesk.com/en/docs/design-automation/v3/developers_guide/overview/
C# SDK https://github.com/Autodesk-Forge/forge-api-dotnet-design.automation
We are using the Inventor and Revit engines.
Used for storing your designs. For communication with Forge Design Automation
https://forge.autodesk.com/en/docs/data/v2/developers_guide/overview/
C# SDK https://github.com/Autodesk-Forge/forge-api-dotnet-client
We are using redux-thunk for complex and asynchronous operations https://github.com/reduxjs/redux-thunk
In index.js
replace
const store = createStoreWithMiddleware(mainReducer);
with
const store = createStoreWithMiddleware(mainReducer, window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__());
https://github.com/Autodesk/hig
Table is not part of todays React HIG implementation so we will use https://github.com/Autodesk/react-base-table
We are using npm.
- Using command line go to
WebApplication/ClientApp
and runnpm install <package>
- Note that packages are normally installed as part of the build, but only if the
npm_modules
directory is not found. This means that when new packages are added,WebApplication/ClientApp/npm install
needs to be run again manually by other users (who did not add the new package).
- Note that packages are normally installed as part of the build, but only if the
- For JavaScript code:
npm run lint
- For CSS:
npm run lint-css
- For an advanced example of CI/CD on AWS, see AWS-CICD
- For a simple method of deploying to Azure, see Publish a Web app to Azure App Service using Visual Studio
- First change
WebApplication.Program.cs
by removing theUseKestrel()
statement - You will need to change the callback in your forge app to match the URL you deploy to.
- First change