AutoCAD

Rtext automatically updates drawing text

1 Dec, 2000 By: Bill Fane


Captain LearnCurve heard the plaintive cry of a far-off AutoCAD user: Woe is me! I have to put the same legal disclaimer text in 20 different AutoCAD drawings! Just create it in one drawing, then cut and paste it into the others. You don't understand! The lawyers haven't finalized the wording yet, but I have to get preliminary drawings out right away. I'll need to change them all later. No problem. Use the Rtext command. Say what? My copy of AutoCAD doesn't have that command! Rtext is one of AutoCAD's Express Tools. The box below explains the whats and wherefores of the Express Tools in various versions of AutoCAD. Once you load the tools, we'll take a look at the Remote Text Express Tool.

Rtext is much like AutoCAD's Xref command, except that it works with text files. The basic operation is simplicity itself. In fact, it is easier to demonstrate with an example than it is to explain.

Figure 1. Use Notepad to create a simple text file.

Start up Notepad and enter a bit of text, as shown in figure 1. Save it to a suitable directory and filename. Now start AutoCAD. Open an existing drawing or start a new one.

Invoke the Rtext command from the Command prompt, or pick Express Tools|Remote Text from the menu bar. Sorry, there's no toolbar pick for the textually challenged.

When Rtext starts, ignore the prompt for the time being and just press <Enter>. Up pops a standard file selection dialog box. Select the text file that you just saved. The text in the file appears as a ghost image, and you can use the cursor to drag around a rectangle the same size as the text. Drag the rectangle where you want to position the text, pick a point, then press <Enter> to take the remaining defaults.

Figure 2. Rtext then creates a special object based on the text file.

Magic! The text from the Notepad file appears as an AutoCAD object in your drawing. It's located on the current layer and takes that layer's color.

If you think that was good, try this—go back to Notepad, make some changes to the text, and save the file again. Go to your AutoCAD drawing and select View|Regen. The text item in the drawing updates to display the revised text from disk. Figure 3 shows Notepad with the new text superimposed on AutoCAD with the updated text item.

Figure 3. If you change the text file, the drawing object automatically updates to follow it.

As you've seen, Rtext lets you create a special text object that gets its contents from a text file on disk. The AutoCAD object automatically stays in step with any revisions to the disk file. It updates whenever you open the drawing and whenever the open drawing regenerates.

Details, details

The first thing to notice is that the AutoCAD text object is not really an exact copy of the text file. For starters, it uses the AutoCAD text style and hence the font and size that are current when you create it. If you take a close look at the Command prompt area when you create an Rtext object, you see that you get two opportunities to change the style, the height, and the rotation angle of the text object. Those are the two occasions when I suggested you press <Enter> to take the defaults.

Next, Rtext does not format the text. A simple ASCII text file, as produced by Notepad, has no line wrapping. Figure 1 shows four lines of text, whereas figure 2 shows only two.

Notepad wraps lines to make them fit its current window size, but it does not apply any line-wrapping codes that carry over into AutoCAD. The AutoCAD object has two lines because I specifically put in a line break by pressing <Enter> in the Notepad file.

The good news is that any number of drawings can point to the same text file, and a single drawing can point to several text files. In both cases, everything updates automatically. You can use AutoCAD's Properties command to edit all the usual properties of an Rtext. In addition to the layer, size, text style, and so on, you can also change the text filename. You have to type in a specific path and filename, however, as Rtext does not bring up a file dialog box.

Gnarly bits
It would be nice to be able to do more text formatting in the text editor. Notepad is not going to cut it. Wordpad appears to work until you try to save your text. Although Wordpad supports several different file formats, the only one that Rtext supports is an ASCII text file. In this mode, Wordpad strips all formatting and special characters just before it saves the file.

How about using a full-fledged word processor such as Word or WordPerfect?

Figure 4. You can use a word processor to get proper line wrapping. Just save as a text file with line breaks.

As figure 4 shows, you can get automatic line wrapping in Rtext by using a word processor, subject to two limitations. First, Rtext’s ASCII text file requirement still applies. Fortunately, most word processors have a Save As option that lets you save it as a text file “with line breaks.” This is the option you need to use. The other problem is that Word invokes file locking, which Rtext honors. You must close the document in Word before Rtext updates properly, then reopen it if you want to do more editing.

The only other significant factor to notice is that Rtext creates a unique, specific type of object in the drawing. If you send a copy of the drawing to someone else, you must also send the text file, and they must have Rtext installed. On the other hand, AutoCAD's standard Explode command will turn the Rtext object into standard text.

But wait, there's more!
Notice the initial prompt when you start Rtext. If you enter a single letter D, the Rtext object does not have to point to an external file. It can contain text in the format of a Diesel programming string, which also executes and hence updates the Rtext object automatically. You can use this to do things such as generate an always-current list of the xrefs attached to a drawing, include the filename and current drive and directory path in the title block, or display the time and date on a plot.

A full treatise on Diesel is beyond the scope of the current column, but the Express Tools Help facility gives several interesting and useful examples.

And now for something completely different
There is a simple trick to coming home from Las Vegas with a small fortune. Go there with a large one.

Express lane to Express Tools
 

Once upon a time, before authorization codes, Autodesk offered a bonus if you registered your software. The Bonus Tools were a series of AutoLISP and ADS programs that added extra functions to AutoCAD. Some were useful utilities, some were prototypes of functions that were incorporated into later releases, and some were just plain fun.

Later, the Bonus Tools appeared on the installation disks or CD-ROM. With AutoCAD 2000 they became known as the Express Tools. They include nearly 100 utility functions.

Release 14 and earlier. Sorry. Rtext did not come along until AutoCAD 2000.

AutoCAD 2000. If your menu bar lacks an Express selection, try typing in the command E Ex xp pr re es ss st to oo ol ls s. If AutoCAD reports Unknown command, go back to the installation CD-ROM and run Setup to add the Express Tools.

AutoCAD 2000i. If you are updating from AutoCAD 2000, the Express Tools should carry forward. If they don't or you're not, you must install them separately. Unfortunately, they don't appear on the installation CD-ROM. You can purchase them at the Autodesk store at www.autodesk.com/estore.

 

AutoCAD Tips!

Lynn Allen

Autodesk Technical Evangelist Lynn Allen guides you through a different AutoCAD feature in every edition of her popular "Circles and Lines" tutorial series. For even more AutoCAD how-to, check out Lynn's quick tips in the Cadalyst Video Gallery. Subscribe to Cadalyst's free Tips & Tools Weekly e-newsletter and we'll notify you every time a new video tip is published. All exclusively from Cadalyst!
Follow Lynn on Twitter Follow Lynn on Twitter


Poll
At your company, who has the most say in CAD-related software purchasing?
CAD manager
CAD users
IT personnel
vice-president/department manager
CEO/company owner
Submit Vote