Sample Code (.NET)


This guide and the 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 help documentation related to the AutoCAD .NET API can be copied to the clipboard and 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.


To run the sample code from the Help files