-
Controlling the Machine is no longer being updated. Don't worry, though, you can still follow Nate Holt at his new blog, AutoCAD Electrical Etcetera. You'll find it at http://nateholt.wordpress.com. Or you can subscribe to his feed to get latest words of wisdom automatically: http://nateholt.wordpress.com/feed/. You also can continue to view the Controlling Machine archives for Nate's AutoCAD Electrical tips and tricks.
-
Match Wire Number Text to Wire Color - AutoCAD Electrical
April 22, 2008, 09:03 AM Nate HoltHere is a simple user request that finds a happy solution using the AutoCAD Electrical "API". A small AutoLISP utility with a few embedded AutoCAD Electrical API calls does the trick.
The Request
Out-of-the-box, AutoCAD Electrical pushes all wire number text out to the user-defined layer under "Drawing Properties". In the example drawing below, the wire numbers all appear yellow because the defined WIRENO layer itself has been set to default to yellow.

But the user prefers to see the wire number take on the color of the wire it is tied to. So wire numbers 59, 60, and 61 display as gray, 64 and 65 red, and the rest white.
So, how to do this? All that is needed is a little post-processing utility to find wire number attributes, find the layer of the wire that the wire number ties to, and flip the attribute's layer to match that wire layer.
The AutoLISP Utility
Here is one way to do it. This AutoLISP utility includes a half-dozen calls into the AutoCAD Electrical API.
Download file from this link, rename to wn_textcolor.lsp
files/21301_21400/21353/file_21353.lsp
To Use
Download the utility and rename it to wn_textcolor.lsp. APPLOAD it. Then type WD_TEXTCOLOR [Enter] at the command line.
Result
Here's the "after" version:

The utility should also find and move the "extra wire number copies" and any wire number leaders.
You must be logged in to post a comment.