Autodesk-Forge / design.automation-.net-custom.activity.sample

Design Automation Sample in C#: C# sample to demonstrate custom Activities and AppPackages creation
MIT License
16 stars 71 forks source link
autocad csharp design-automation

Design Automation API for AutoCAD - Create custom Activity and AppBundle

.NET odata Design Automation visual studio License

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

thumbnail

Industry Background

Setup

Dependencies

Prerequisites

  1. 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.
  2. Make a note with the credentials (client id and client secret) of the app.

Running locally

  1. 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.
  2. 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)
  3. Put your Forge credentials into an appsettings.user.json like this
    {
    "Forge": {
        "ClientId" : "<your client id>",
        "ClientSecret" : "<your client secret>"
    }
    }
  4. Add your friendly name for your app.
  5. Replace the upload URL with your own.
  6. Run project Client, you will see a status in the console: thumbnail
  7. 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.
  8. if there is any error with the process of work item, check the report file what error is indicated.

Troubleshooting

Known Issues

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