- Oh no! An error has occurred!
- You need to be logged in to do that.
- You need to be logged in to do that.
- You need to be logged in to do that.
-
Coinciding with the acquisition of VIA Development, Nate joined Autodesk in March of 2003 after a decade stint as an entrepreneur following a two-decade stint as a controls engineer and software applications developer at Owens-Corning. Nate is now the lead product architect for AutoCAD Electrical. He loves this stuff.
-
Bypassing AutoCAD Electrical's Automatic Wire tag-ID assignments
March 6, 2007, 12:33 AM Nate HoltThere may be times when you want to bypass the automatic wire number features of AutoCAD Electrical and make sequential wire number assignments manually. You can use the existing Edit Wire Number tool but that is one-at-a-time and becomes a bit tedious (very tedious!) if you have a whole sheet of wire numbers to assign.
A dream solution might be this... you select a beginning wire number and then just start pick, pick, picking on the wires in the order that you want the wire number assignments to appear. The wire number will pop in at your pick point on the wire network. Not only that, but it would also make sure that each new wire number is unique - that a wire number is not already used on some other drawing in your project set.

So, what to do? AutoCAD Electrical's user customization tool set, its "API", might provide a solution. A quick scan of the API documentation under AutoCAD Electrical's On-line help uncovers this cool function:

It inserts a "fixed" wire number (first passed argument) located at your pick point (second passed argument) on a valid wire LINE entity. The fact that it is "fixed" is good. This means that any subsequent re-tagging of the drawing's wire numbering will not override the fixed wire number value that you have assigned to this wire.
Let's put together a small AutoLISP utility and wrap it around this API function to give us our "dream" wire numbering tool.
If you Build It, They (the wire numbers) will Come
Here is the front end part of the utility as shown in AutoCAD's built-in Visual Lisp editor.

STEP 1 (above)
The function name we're defining is "wnumpick". There is some standard AutoCAD Electrical initialization calls at the beginning. Next the program is set to prompt us for our desired starting wire number. If this program was run earlier on this drawing and we're just restarting the command, then the ending wire number of the previous run is presented as a default (stored in global variable GBL_wd_wnumpick_last_fixed_wnum).
After getting the starting wire number, the program does a quick read of the active drawing to get a list of all existing wire numbers already in use. This is stored in variable "dwg_wirenum_lst". This is part of the process of making sure that we don't repeat a wire number on the active drawing.
This on-drawing list and proposed starting wire number is passed to a function "wd_wnum_find_next_wireseq_tag..." that checks this against the on-drawing list and an extract project-wide list (minus the active dwg). It returns the pass wire number if it is not a repeat or the next available (i.e. next greatest unused) wire number. The utility prompts for a pick point on a line wire.

Step 2 (above)
The utility now checks that the picked line entity is on a defined wire layer, that there is no existing wire number tied to it, and there is no signal "destination" on the picked wire network. The latter is because we cannot insert a pre-defined, fixed wire number on a wire network that is to receive its wire number from some other "source" network.

Step 3 (above)
Now here's where we call the API function to insert the fixed wire number on the selected line entity at the picked XY coordinate. In it goes. We increment the starting wire number and loop back up to the top for the next "pick".
Download a copy of this utility here and give it a shot. It should work in ACE 2007 or higher. To use, APPLOAD the file. Then type WNUMPICK [Enter] at the command line.
Comments
-
March 14, 2007 05:55 AM Steve Lumb
Nate, I have tried using this routine and it worked perfectly well, however I have set up wire layers and wire number formats as follows, L1 = %NL1; L2=%NL2; L3=%NL3; NEUTRAL=N%N; 24VDC=%N; 0VDC=0; PLC_IP=I%N; PLC_OP=O%N. For some reason the PLC_OP stopped numbering as the wire layer format override until I renamed wnumpick.lsp. Just thought I'd let you know. Regards, Steve Lumb
You must be logged in to post a comment.