This repository contains C# project of a simple AutoCAD CRX plug-in for use with the Design Automation for AutoCAD tutorial. The plug-in implements an AutoCAD custom command named LISTLAYERS. This command extracts layer names from the current drawing and saves them to a text file.
- Visual Studio. This sample was created in Visual Studio 2017.
- AutoCAD .NET API. This sample was built using the AutoCAD 2020 .NET API.
-
Open command.sln in Visual Studio.
-
In Visual Studio, in the Solution Explorer, right-click the project name. A menu displays.
-
Click Manage NuGet Packages. The Manage Packages for Solution dialog displays.
-
Click Restore, which is on the top-right of the dialog. The packages are downloaded and restored.
-
Build the solution.
We recommend that you test the custom command on your local machine before you use it in Design Automation.
-
Start AutoCAD. (This code sample was tested with AutoCAD 2020)
-
Open a drawing file. You can use any of the drawing files from the AutoCAD samples page.
-
On the AutoCAD command line, enter NETLOAD.
-
Select command.dll that you built in the previous section.
-
On the AutoCAD command line, enter LISTLAYERS. If the plug-in executes as designed, a text file containing the layer names is generated. The file is typically saved in the folder that you most recently interacted with in AutoCAD.