cadalyst
AutoCAD

Add AutoLISP to a Custom AutoCAD Command

10 Mar, 2014 By: Andrew G. Roe

Combine AutoLISP commands with a VB.NET plugin.


Create a New Custom Command

We’ll create a new custom command, slightly different than the one we created previously, to run the plugin and also execute the AutoLISP statements.

1. In AutoCAD, click the CUI icon in the Manage tab of the ribbon to load the Customize User Interface dialog box. (You can also load this dialog box by typing CUI at the Command line and pressing Enter.) The Customize User Interface dialog box is displayed.

2. In the Command List portion of the CUI dialog box, click the Create a new command icon.

3. In the Properties portion of the CUI dialog box, type MyCircleCommand2 in the Name box.

4. In the Macro box, type the following:

     ^C^CCreateMyCircle;Filedia 1;(setq en (entlast));(entget en);

The ^C^C is already present in the Macro box, indicating the beginning of the macro, and is the equivalent of pressing the Escape key twice to clear any active commands. The semicolon (;) is the equivalent of pressing Enter. The custom command sets the Filedia variable back to 1, then executes the two AutoLISP statements.

5. In the Customizations in All Files portion of the CUI dialog box, expand the Menus item to show the various menus.

6. In the Command List portion of the CUI dialog box, click the drop-down list and select Custom Commands. The MyCircleCommand2 should be listed.

7. Drag the MyCircleCommand2 to the Modify menu above.



8. Click OK to close the CUI dialog box.

1 2 3 


Add comment

Cadalyst Fab Freebies 2021: The editors of Cadalyst, with help from our contributors and readers have updated everyone's favorite guide to software tools and resources that don't cost a cent. "Fabulous Freebies for CAD Users" has something for everyone. Download our guide today!


More News and Resources from Cadalyst Partners

Take the Gradual Path to BIMWhite Paper: Take the Gradual Path to BIM. Implementing building information modeling (BIM) can be a daunting challenge, but you don't have to take on everything at once. Learn how small, incremental advances can yield big benefits over time. Download your paper today!