<PackageReference Include="ricaun.Autodesk.Forge.Oss.DesignAutomation" Version="*" />
- .NET 6 or later
- A registered app on the Autodesk Platform Service.
By default the Forge credentials could be defined with the following environment variables:
FORGE_CLIENT_ID=<your client id>
FORGE_CLIENT_SECRET=<your client secret>
You can define a custom header to be sent with each Design Automation requests to the Forge API. The custom header is only enabled if the engine is deprecated.
FORGE_CLIENT_CUSTOM_HEADER_VALUE=<your custom header>
The custom header follow pattern x-my-custom-header: engine value is {0}
. (The value {0}
is replaced with the engine+version.)
The header gonna be x-my-custom-header
and the value engine value is Autodesk.Revit+2023
when using the engine Autodesk.Revit+2023
.
This repository contains each sample of the Autodesk Step-by-Step Tutorial.
- Autodesk Tutorial for 3dsmax - DA_3dMax.cs
- Autodesk Tutorial for Autocad - DA_AutoCAD.cs
- Autodesk Tutorial for Inventor - DA_Inventor.cs
- Autodesk Tutorial for Revit - DA_Revit.cs
The package use the namespace Autodesk.Forge.Oss.DesignAutomation
.
DesignAutomationService
class contain the methods to interact with the Oss and Design Automation API.
Internaly uses the ParameterArgumentService
to convert a class with Attributes
to convert in the Activity
and WorkItem
to send the request to the Design Automation API.
IDesignAutomationService designAutomationService = new MaxDesignAutomationService("AppName")
{
EngineVersions = new[] { "2021" },
};
IDesignAutomationService designAutomationService = new AutoCADDesignAutomationService("AppName")
{
EngineVersions = new[] { "24" },
};
IDesignAutomationService designAutomationService = new InventorDesignAutomationService("AppName")
{
EngineVersions = new[] { "2021" },
};
IDesignAutomationService designAutomationService = new RevitDesignAutomationService("AppName")
{
EngineVersions = new[] { "2021" },
};
Initialize AppBundle
by creating and uploading the zip file to the Design Automation.
await designAutomationService.Initialize("Path/AppBundle.zip");
Create the Activity
and run the WorkItem
and wait for the result, use the Parameters
class to define the parameters of the Activity
and WorkItem
.
bool result = await designAutomationService.Run<Parameters>();
bool result = await designAutomationService.Run<Parameters>((parameters) => {});
Parameters parameters;
bool result = await designAutomationService.Run<Parameters>(parameters);
Delete all the resources created by the Initialize
and Run
.
AppBundle
and Activity
gonna be deleted if exists.
await designAutomationService.Delete();
The Parameters
class is used to define the parameters of the Activity
and WorkItem
using the Attributes
.
ParameterInputAttribute
- Define the input parameter of theActivity
andWorkItem
.ParameterOutputAttribute
- Define the output parameter of theActivity
andWorkItem
.
Base class ParameterActivityAttribute
is used to update the Activity
before send the request to the Design Automation API.
ParameterActivityClearBundleAttribute
- Clear theAppBundle
before update theActivity
.ParameterActivityInputArgumentAttribute
- Define the input argument of theActivity
.ParameterActivityInputAttribute
- Define the input parameter of theActivity
.ParameterActivityInputOpenAttribute
- Define the input parameter of theActivity
withOpen
file.ParameterActivityLanguageAttribute
- Define the language of theActivity
.ParameterActivityScriptAttribute
- Define the script of theActivity
.
Base class ParameterWorkItemAttribute
is used to update the WorkItem
before send the request to the Design Automation API.
ParameterWorkItemTimeSecAttribute
- Define the timeout of theWorkItem
.
This project is licensed under the MIT Licence.
Do you like this project? Please star this project on GitHub!