-
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.
-
Creating Special Wire From/To Annotation - AutoCAD Electrical
February 21, 2007, 07:45 PM Nate HoltThis was an interesting request originating from the gas/oil industry. The user wanted the control schematics to be annotated with individual from and to tags. For example, let's say a pushbutton is shown wired to a motor starter coil and then jumpered down to a pilot light. The "wire tag" of the wire end at the pushbutton would show the tag-ID and pin number of the motor starter coil. The same for the jumpered pilot light. The motor start coil's pin would be tagged with both the pushbutton and the pilot light since is is common to both.
Example: BEFORE

AFTER

AutoCAD Electrical API to the Rescue (again)
Well, out-of-the box, AutoCAD Electrical is not set up to annotate the schematics this way. It has the data and can REPORT these connections this way. But it is not set up to actually INSERT pieces of "smart" from/to text right on each connection of the schematics.
What we want is this:
1. Insert the annotation at the wire connection points, justify and rotate to follow the connected wire.
2. Annotation to follow the same as a from/to report taking into account any special "wire sequencing" overrides or source/destination arrow connections.
3. Text can be manually repositioned.
4. Text will be "smart" in that it can be updated if connections changed - even if the text is moved.
5. Text put on its own layer so it can be turned off (i.e. layer "frozen").
Here is a small AutoLisp utility that is roughed out to provide the above. If you want to give it a try, download the file, APPLOAD it, and type OTHER_END [Enter] at your command line. The active drawing should update.
How it works
Key snippets of the utility are shown below.
Step 1: Extract all wire from/to connection data for the active drawing.

Step 2: Create a selection set of all block insert instances found on active drawing.

Step 3: Loop through the selection set, find schematic "components" blocks with wire connections. Format the connection information into a short string of text.

Step 4: Insert TEXT entity with the formatted text.

Step 5: Flip the new text entity to the target layer. Then insert an Xdata pointer on the wire connection point that points back at this new TEXT entity.

How can I make this Cooler?

Don't be afraid to modify this utility to fit your wants/needs. For example, you might want it to insert multi-line MTEXT instead of a single line TEXT entity. Maybe you'd rather have it insert a "LEADER" entity. How about adding more info to the text, like wire type or include the INST/LOC values in the tag for IEC drawings? Use your imagination... go for it!
You must be logged in to post a comment.