/forge-listlayers-designautomation

Sample AutoCAD plugin migrated to run with Design Automation for AutoCAD

Primary LanguageC#MIT LicenseMIT

ListLayers CRX Plug-in for Design Automation for AutoCAD Tutorial

visual studio AutoCAD License

Description

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.

Dependencies

Build the project

  1. Open command.sln in Visual Studio.

  2. In Visual Studio, in the Solution Explorer, right-click the project name. A menu displays.

  3. Click Manage NuGet Packages. The Manage Packages for Solution dialog displays.

  4. Click Restore, which is on the top-right of the dialog. The packages are downloaded and restored.

  5. Build the solution.

Test the custom command

We recommend that you test the custom command on your local machine before you use it in Design Automation.

  1. Start AutoCAD. (This code sample was tested with AutoCAD 2020)

  2. Open a drawing file. You can use any of the drawing files from the AutoCAD samples page.

  3. On the AutoCAD command line, enter NETLOAD.

  4. Select command.dll that you built in the previous section.

  5. 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.