ActiveX Automation is a technology developed by Microsoft® and is based on the COM (component object model) architecture. You can use it to extend AutoCAD-based products, share your drawing data with other applications, and automate tasks.
You can create and manipulate drawing objects from any application that serves as an Automation controller. Thus, Automation enables macro programming across applications, a capability that does not exist in AutoLISP.
The advantage of implementing an ActiveX interface for the program is twofold:
For example, you might want to prompt for input, set preferences, make a selection set, or retrieve drawing data. You can decide on the controller to use, depending on the type of manipulation.
The displayed objects are called Automation objects. Automation objects make methods, properties, and events available. Methods are functions that perform an action on an object. Properties are functions that set or return information about the state of an object. Events are user-initiated actions or occurrences to which a program responds.
Virtually any type of application can access the exposed Automation objects within AutoCAD. These applications can be stand-alone executables, dynamic linked library (DLL) files, and macros within applications such as Microsoft Word or Microsoft Excel. The most common of these is likely to be a stand-alone executable. If you are using applications from third-party developers, follow their instructions for installation and use of their product.
You can use the acad.pgp file to define a command that runs an external command to start a stand-alone application; similar to that of a command alias which can be used to start a command.
The following example defines the RUNAPP1 command, which executes app1.exe from the c:\vbapps\ directory. (Add this code to the external commands section of your acad.pgp file.)
RUNAPP1, start c:\vbapps\app1, 0
If your application requires command line parameters, you can use the following code:
RUNAPP2, start c:\vbapps\app2, 0, *Parameters: ,
This example defines the RUNAPP2 command, which prompts you for parameters and then passes them to your application.
You can also use the AutoLISP startapp function to start an application that makes use of Automation. Once AutoLISP starts the external application, it has no control over its actions. You can, however, use AutoLISP to locate and run different applications based on certain parameters.
After defining an external command to start a stand-alone application, you can use that command as part of a command macro from a user interface element.
If you use only one or two applications, you can add them to one of the standard ribbon panels or the Quick Access toolbar. If you have a group of applications, you can define your own ribbon panels that are specifically dedicated to those applications.