AutoCAD

Add AutoLISP to a Custom AutoCAD Command

11 Mar, 2014 By: Andrew G. Roe

Combine AutoLISP commands with a VB.NET plugin.


Run the Script and Custom Command

To run the script and custom command, follow these steps:

1. Click the Run Script icon in the Manage tab of the ribbon. (You can also type Script in the Command line, then press Enter.) The Select Script File dialog box is displayed.

2. Navigate to the previously created file and select it.

3. Click Open to run the script.

4. From the Modify menu, select MyCircleCommand2. The command is executed, creating a circle and text as in the previous article and also displaying information on the Command line about the last entity created.



This example provides a simple demonstration of combining AutoLISP commands with a VB.NET plugin. You could expand on this approach by building a more complex AutoLISP routine, saving it in a separate text file, then loading and executing it from the custom command. You can also load an AutoLISP routine prior to executing the command in several different ways. For more information on this, consult the AutoLISP online help guide entry, “About Auto-Loading and Running AutoLISP Routines.”

As you can see, scripts and custom commands can be combined in various ways to meet your needs. In future articles, I'll continue to explore additional facets of AutoCAD programming. If you would like to suggest a topic, feel free to send me an e-mail.

1 2 3 


Add comment

Note: Comments are moderated and will appear live after approval by the site moderator.

AutoCAD Tips!

Lynn Allen

Autodesk Technical Evangelist Lynn Allen guides you through a different AutoCAD feature in every edition of her popular "Circles and Lines" tutorial series. For even more AutoCAD how-to, check out Lynn's quick tips in the Cadalyst Video Gallery. Subscribe to Cadalyst's free Tips & Tools Weekly e-newsletter and we'll notify you every time a new video tip is published. All exclusively from Cadalyst!
Follow Lynn on Twitter Follow Lynn on Twitter


Poll
Which file format do you use most often for CAD drawing/model exchange?
Native format
PDF
3D PDF
DWF
STEP or IGES
JT
IFC
Other
Submit Vote