Avatech Tricks: Hotwire AutoCAD Electrical

14 Sep, 2005 By: Carl Smith Cadalyst

Customize AutoCAD Electrical to make drawing point-to-point wire diagrams more productive

Out of the box, AutoCAD Electrical may seem as though the product is strictly geared toward ladder-style diagrams and panel layouts. But you can easily modify the program for all sorts of electrical controls design, including point-to-point wire diagrams (figure 1).

Figure 1. A typical point-to-point wire diagram.

Typically, a point-to-point diagram will contain wires of several different colors and gauges. By default, you will need to switch to the appropriate wire layer each time a different gauge or color is required. This process can take extra time and effort if your design contains many layers or includes many types of wire gauges and colors.

Creating a custom toolbar to automate this process can greatly enhance point-to-point design productivity. Our toolbar will create the appropriate layer if it does not exist yet, make that layer current and then launch AutoCAD Electrical's Insert Wire command.

AutoCAD Electrical looks for lines drawn on specific layers and defines these lines as wires. Once the wires are identified, the software can automatically create several types of wire reports, including from/to lists, as well as automatically assign unique wire numbers to each wire network. In the AutoCAD Electrical configuration tools, I used a wildcard to tell AutoCAD Electrical that any layer that begins with 8AWG is a valid wire layer (figure 2). The next step is to create a custom toolbar that will make it easy for me to choose the wires I need on the fly.

Figure 2. Selecting the layers beginning with 8AWG as valid wire layers.

Figure 3. Our example toolbar with a simple set of wires.
This toolbar will be a simple starter set of wires (figure 3), but you can create a much more complex toolbar, with flyouts perhaps, that would include all of the wire gauges and colors that would be appropriate for the design.

I named the new toolbar "My Wires" and included buttons on the toolbar and color-coded each to match the appropriate wire color. I can use these buttons to draw blue, red, green and brown 8-gauge wires.

Each button is customized to execute the following command:

^C^C(if (tblsearch "LAYER" "8AWG-BRN") (command "-layer" "C" "46" "8AWG-BRN" "") (command "-layer" "N" "8AWG-BRN" "C" "46" "8AWG-BRN" ""))(command " layer" "S" "8AWG-BRN" "")(if(not wd_load)(if(setq x(findfile "wd_load.lsp"))(load x)))(wd_load);wd_inwire

This string will search the current layers of the drawing for a layer named 8AWG-BRN, and if it does not find the layer, it will create it and make that layer current. Next it will launch the AutoCAD Electrical WD_INWIRE command to begin drawing a line that AutoCAD Electrical will interpret as a brown 8-gauge wire. Each button contains the same macro, tweaked just slightly so that the appropriate layer name and color will be created.

Now, rather than constantly digging through the layer list each time I need a new wire gauge or color, I can simply use to my new custom toolbar and let the macro do all the work!

That's all there is to it. You need only to configure AutoCAD Electrical to understand your wire layer naming convention and create your own set of custom toolbars. Tweak the macro to suit your needs and you're ready to wire.

About the Author: Carl Smith

More News and Resources from Cadalyst Partners

For Mold Designers! Cadalyst has an area of our site focused on technologies and resources specific to the mold design professional. Sponsored by Siemens NX.  Visit the Equipped Mold Designer here!

For Architects! Cadalyst has an area of our site focused on technologies and resources specific to the building design professional. Sponsored by HP.  Visit the Equipped Architect here!