Get Cell Data of AutoCAD Table by Design Automation API

April 23, 2017

Design Automation API of Forge  provides the ability to run scripts on your design files, leveraging the scale of the Forge Platform to automate repetitive tasks. Recently, I got a question the customer wanted to get out the cell data from AutoCAD Table entity. So I wrote a small sample code in C#. The whole project is avaialble at:

https://github.com/xiaodongliang/forge-design.automation.autocad-test-harness/tree/getDrawingTableInfo

The workflow is very simple:

1. create an AutoCAD plugin in C#. Create a command to dump the information of cells of all tables in the drawing. To make the data be used easily in downstream, I produced the information in the format of Json: Table>>Table Row>>Table Cell.

2. create a client program to test with Design Automation API of Forge: 

    2.1) make a bundle of the plugin and its PackageContents.xml. The guidance of bundle format (also called AutoLoader) can be found at App Store of ADN Open.

    2.2) compress this bundle to an zip. Uploade the zip with the url from AppPackages/Operations.GetUploadUrl

    2.3) create an AppPackage of Design Automation by the endpoint: POST AppPackages. set Resource as the location of the bundle zip which has been uploaded in #2.2.

    2.4) create an Activity of Design Automation by the endpoint: POST Activities. link this Activity with the AppPackage  in #2.3

    2.5) create a WorkItem of Design Automation by the endpoint: POST WorkItem, input the source DWG drawing. 

The workitem will run with the custom command in #1. After getting the cell data, one json file will be downloaded.

 

 

 

Posts by author

Xiaodong Liang has been with Autodesk since 2007, focusing on providing programming support, consulting, training and evangelism to external developers.