Note: You must have Express Tools installed within AutoCAD for the examples in this tutorial to function correctly or to even make sense. Express Tools are installed by default in recent versions of AutoCAD. In older versions (2006 and earlier), it is an install option except for 2002, where they were not included on the install media

Express Tools tab

You can check to see if you have the Express Tools installed by looking at the Ribbon. You should see the “Express Tools” tab at the right-hand end in all the standard workspaces. If the Express Tools tab is not displayed on your ribbon, follow the Load Express Tools tutorial to install the tools and display the tab.

Personally, I believe that Rtext is one of the best functions within the Express Tools Suite.

In this tutorial, we are going to have a look at how Rtext can help us with our drawing setups along with a few other little things.

Firstly, you need to download this zip file that contains a drawing named “Rtext_Setup.dwg”, three sample Xref drawing files,  as well as a text file entitled “Notes.txt”.

Place them all in a directory within your AutoCAD support path and then open the drawing “Rtext_Setup.dwg.

Let’s have a look at the Title Block Data. Click the Application Button (big red ‘A’), select “Drawing Utilities” and then “Drawing Properties”. If you are using an older (pre-Ribbon) version of AutoCAD or the “AutoCAD Classic” workspace, you can open the “Drawing Properties” dialog by clicking the File drop-down menu and then selecting “Drawing Properties”.

Now choose the “Summary” tab. It should look like this:

Drawing Properties - Summary tab

Change the value of the “Title” edit box. Now choose the “Custom” tab.

Drawing Properties - Custom tab

Change a few of the entries in the “Value” edit boxes.

DO NOT change the values in the “Name” edit boxes.

Now, close the “Drawing Properties Dialog, zoom into the title block and Regen the drawing.

project details

drawing details

Did you see the values in the title block update to suit the changes you made?

Zoom into the lower right of the drawing. You should see this, although I’ve rotated it for clarity:

plot stamp

Hey thanks Kenny!!! A lovely little plot stamp. Regen the drawing after a minute or so and watch the time update automatically.

Now zoom into the lower left corner of the drawing:

XREF details

This is a list of all the Xrefs that are attached to this drawing. To test it, Detach one of the Xrefs from the drawing and Regen the drawing. The list will update.

Now open up the text file “notes.txt” within Notepad and make a few changes to the notes. Save the file and return to the drawing. Again Regen your drawing, and again watch the notes automatically update.

Note: If you don’t see the notes displaying in the drawing and instead see “RTEXT: file load error”, you may need to change the path to notes.txt. To do this, double-click the errot message to display the Properties dialog. In the “Text” section, change the path text in the “Contents” edit box.

Notes from an external file

All of these magic tricks were achieved by using the Rtext function along with a few Diesel expressions. Let’s now have a wee bit of a closer look!!

Rtext on the RibbonRtext objects are created with the Rtext command, one of the many Express Tools. You’ll find the command on the fly-out of the text panel on the Express Tools tab of the Ribbon, or you can type RTEXT at the command prompt. Remote text (RText) objects are displayed the same way normal Text, Dtext or MText objects are displayed, but the source for the text is either an external text file or the value of a DIESEL expression. You can edit an RText object with the RTEDIT command.

Command: RTEXT
Current text style: STANDARD  Text height: 0.2000  Text rotation: 0
Enter an option [Style/Height/Rotation/File/Diesel] <Diesel>: Specify an option
Rtext Options
Style Selec a text style.
Height Specify a text height.
Rotation Specify a rotation value.
File Use an external text file.
Diesel Use DIESEL code.

Tip: Once you have created an RText object with the File option, you can identify the associated text file with the LIST command.

Note: If a drawing with an RText object is opened on a computer that does not have RTEXT installed, the proxy object that results displays the bounding box of the RText object. If you plan to send your drawing to someone who does not have RTEXT, you can explode the RText objects to MText objects with the EXPLODE command.

You can use an RText object as a file reference to display text, such as a sheet note or a legal disclaimer, that is common to several drawings. You can also use it to display larger bodies of text such as specifications or assembly instructions.

Here are some examples of how RText objects with DIESEL expressions can be used in your drawings.

To display the drawing name:

Drawing file: $(getvar, "dwgname")

Output: Drawing file: 102-fp12.dwg

To include the directory path with the file name:

Drawing name: $(getvar, "dwgprefix")$(getvar, "dwgname")

Output: Drawing file: C:\Projects\97-102\Arch\102-fp12.dwg

Note: If you reference the drawing path or name in a standard title block, it will always display the file name of the drawing, even if the title block appears in an Xref file.

When you plot a drawing, you may want the hard copy to show the date and the time that the plot was created. The following DIESEL expression displays this information in your drawing:

$(edtime, 0, MON DD","  YYYY - H:MMam/pm)

Output: May 22, 2012 – 11:12pm

The $(getprop) DIESEL function

RText supports Drawing Properties through a locally defined $(getprop) DIESEL function. With $(getprop), values from Drawing Properties dialog box tabs can be extracted and displayed in RText objects.

The syntax for the $(getprop) DIESEL function is:

$(getprop, property name)

Where “property name” can be any of the following fields from the DWGPROPS command:

Title
Subject
Author
Comments
Keywords
LastSavedBy
Revno
Custom Property the name of a custom property

For example, if the Drawing Properties for a drawing contains the text “Excavated Site” is the Subject, the DIESEL expression:

Subject: $(getprop, subject)

In an RText object will display as:

Subject: Excavated Site

Note:$(getprop) DIESEL function is supported only in RText objects. Unlike arguments supplied to other DIESEL functions, arguments to $(getprop) cannot be quoted. Arguments are not case sensitive.

If you have a custom property named “Project Name”, the following DIESEL expression will display the value:

Project: $(getprop, %PROJECT NAME)

Note: Errors in using $(getprop), such as improper syntax or bad arguments, will display (GETPROP ERROR). If a nonexistent custom property name is used, $(getprop) will display an empty string.

The $(xrefs) DIESEL function

RText supports listing Xref files attached to a drawing through the $(xrefs) DIESEL function.

The syntax for the $(xrefs) DIESEL function is:

$(xrefs [, flags [, leader [, trailer]]])

Where “flags” is a bitflag value; valid options are shown in the table below,
“leader” is a text string to be inserted before each Xref entry and
“trailer” is a text string to be appended to each entry except the last.

Bitflag values and their meaning
1 (default) include Xref file name (not exclusive with flag 2)
2 include Xref block name (not exclusive with flag 1)
4 don’t display file name extension
8 don’t display path
16 show nesting with additional spacing

Note: Bitflag values are added for compound output, so a value of 5 would display the path and filename but without the file extension.

Examples

The RText DIESEL expression $(xrefs,3)displays a list of Xrefs in the following format:

B-ELEC [c:\proj-14\b-elec.dwg]
M-ELEC [c:\proj-14\m-elec.dwg]
R-ELEC [c:\proj-14\r-elec.dwg]
F-ELEC [c:\proj-14\f-elec.dwg]

While the expression $(xrefs,2,Includes: ) will list the Xrefs as:

Includes: B-ELEC
Includes: M-ELEC
Includes: R-ELEC
Includes: F-ELEC

The $(images) DIESEL function

RText supports listing images attached to the drawing through the $(images) DIESEL function. The syntax for the $(images) DIESEL function is:

$(images [, flags [, leader [, trailer]]])

Where “flags” is a bitflag value; valid options are shown in the table below,
“leader” is a text string to be inserted before each entry and
“trailer” is a text string to be added after each entry except the last.

Bitflag values and their meaning
4 don’t display file name extension
8 don’t display path

Behavior is similar to the $(xrefs) function.

The $(getrec) DIESEL function

>RText supports displaying Xrecord data through the $(getrec) DIESEL function. The syntax for the $(getrec) DIESEL function is:

$(getrec, key, code)

Where “key” is the entry name in the Named Object Dictionary and
“code” is the group code to extract.

The $(getrec) function extracts a value from an Xrecord by looking in the Named Object Dictionary for key, then for a data value associated with code. Currently, only group codes in the ranges 1-9 (string), 40-59 (real), 60-79 (integer) and 300-309 (string) are supported.

by Kenny Ramage & David Watson

Advertisements