Design Automation API for AutoCAD - Create custom Activity and AppBundle
![License](https://img.shields.io/:license-mit-red.svg)
Description
This is C# sample to demonstrate custom Activities and AppBundle creation. This is the most
common use case that the Design Automation API can run the custom command (defined in the custom package) in the cloud. This sample uses v3
, for the v2
sample, please check design.automation.v2 branch
Thumbnail
Industry Background
- To batch extract layers list and blocks list from the AutoCAD drawing by web services, instead of running plugin in local AutoCAD.
Setup
Dependencies
- Download and install Visual Studio. In the latest test, Visual Studio version is 2017.
- Download and install AutoCAD SDK. In the latest test with this sample, AutoCAD version is 2018.
Prerequisites
- Forge Account: Learn how to create a Forge Account, activate subscription and create an app at this tutorial. Make sure to select the service Design Automation.
- Make a note with the credentials (client id and client secret) of the app.
Running locally
- Build project CrxApp. It is better to test with local AutoCAD to verify the process. Steps:
- Open AutoCAD (in the latest test, the version of AutoCAD is 2018)
- Open demo drawing. Run command "netload", select the binary dll of CrxApp. Allow AutoCAD to load it.
- Run command "test", select demo json file. Specify a output folder.
- Finally the blocks name list and layers name list will dumped out.
- Open project Client. Restore the packages of the project by NuGet. The simplest way is
- VS2012: Projects tab >> Enable NuGet Package Restore. Then right click the project>>"Manage NuGet Packages for Solution" >> "Restore" (top right of dialog)
- VS2013/VS2015/2017: right click the project>>"Manage NuGet Packages for Solution" >> "Restore" (top right of dialog)
- Put your Forge credentials into an appsettings.user.json like this
{
"Forge": {
"ClientId" : "<your client id>",
"ClientSecret" : "<your client secret>"
}
}
- Add your friendly name for your app.
- Replace the upload URL with your own.
- Run project Client, you will see a status in the console:
![thumbnail](https://github.com/Autodesk-Forge/design.automation-.net-custom.activity.sample/raw/master/demofiles/IORunning.png)
- if everything works well, the result zip file and the report files will be downloaded to MyDocuments. In zip file, blocks list and layers list are available.
- if there is any error with the process of work item, check the report file what error is indicated.
Troubleshooting
- if any problem when building the project CrxApp, check if the NET Framework of project is compatible with that of AutoCAD References. e.g. with AutoCAD 2018 references, the NET Framework is 4.6.1
Known Issues
- as of writing, Design Automation of Forge is released with version 2. Odata is used with .NET project. In futher version, OData might not be used.
Further Reading
License
These samples are licensed under the terms of the MIT License. Please see the LICENSE file for full details.
Written by
Jonathan Miao & Albert Szilvasy