The AutoCAD Electrical API entry point list consists of a series of entry points into the AutoCAD Electrical software executable. This API allows a user to create custom applications such as automatic schematic generation or custom drafting/design utilities based upon the AutoCAD Electrical "engine".
The AutoCAD Electrical API is AutoLISP/VisualLisp based but it not limited to this development environment. It can be invoked from VB, VBA, C++/arx, AutoCAD script files, or embedded into custom AutoCAD menus.
Development Environments, Illustrative Examples
The following example illustrates the same custom command created in AutoLisp, C++/ObjectARX, and Visual Basic. This example makes calls to two of AutoCAD Electrical's API routines:
- "ace_get_wnum" - find and return the wire number associated with a given wire line entity.
- "wd_putwn" - write a new wire number value back out to a wire "network".
This program is to map a Japanese color suffix to each wire number based upon the name of the wire's LINE layer name. For example, if wire number "101" is on a LINE wire drawn on layer name 14AWG-RED-THHN then this utility applies a "red" suffix (in Japanese) to the wire number text.
Spreadsheet --> PLC I/O Generator
AutoCAD Electrical's spreadsheet to PLC I/O utility can generate a set of PLC I/O drawings from data pulled from an Excel spreadsheet. This command is supplied in uncompiled source code form (and also executed from this uncompiled form) to serve as an example of a large, intricate application that makes heavy use of the API.
The program file is wdio.lsp (and companion dialog definition file wdio.dcl). The default install location for these two files is "c:\program files\autodesk\acade 2008\support\". You might use a copy of this program file as a model for creating your own custom drawing generation application.
The following Lisp utility can be referenced by the title block mapping file (the ".wdt" file) or encoded into your title block's "WD_TB" invisible attribute value (if that's the method you use to link your title block to AutoCAD Electrical).
When this utility runs, it returns the last wire number it finds on the drawing. If no wire numbers found then it returns blank. It excludes wire numbers that are associated with wire networks having "Destination" wire signal arrows on them (meaning that the actual wire number assignment was made on some other drawing).