Sample Code

This guide and the AutoCAD 2011 ObjectARX SDK together contain a large number of sample projects, subroutines, and functions that demonstrate the use of the classes, structures, methods, properties, and events that make up the AutoCAD .NET API.

You can also find sample projects that demonstrate some of the aspects of the AutoCAD .NET API on the Autodesk website at These sample projects show a wide range of fuctionality, from extracting AutoCAD drawing data into Microsoft Excel spreadsheets to drawing and performing stress analysis on an electrical transmission tower.

Many of these samples show how to combine various aspects of the VB.NET and C# programming languages with the power of the AutoCAD .NET API to create custom applications.

Additionally, sample code in the AutoCAD .NET Developer's Guide can be copied from the Help files, pasted directly into an open code editor window in Microsoft Visual Studio, and then built and loaded in AutoCAD. At the top of most code samples in this guide are the namespaces that are required for that particular sample. Add those that are need to top of the code window.

NoteThe sample code in the Help files contains limited error handling to keep the concepts simple and easy to read. You should apply additional error handling and checking when using any sample code in your project. For more information on error handling, see Handle Errors.


To run the sample code from the Help files