Learning Curve: Playing the Fields
14 Sep, 2005 By: Bill Fane CadalystYet more advanced uses for handy those field objects
It was a beautiful, sunny, summer afternoon. Captain LearnCurve did some water skiing in the morning and was now sitting with drink in hand listening to the birds singing, his grandchildren laughing and frolicking in the lake, and the message wailing from his editor wondering where his column was.
Last month's column introduced the new field objects in AutoCAD 2005. We saw how they are basically self-updating text objects. The first simple example was an annotation that indicated the length of a line. When the line was edited, the length annotation updated at the next regeneration.
At first glance this process did not appear to be that wonderful, because a simple dimension will do the same thing without requiring the regen. Ah, but the fun came when we realized field objects are available to extract almost any property of an object. We can have self-updating fields that show an object's layer, color, line type, coordinates and so on.
At second glance you still might not use most of the foregoing list in most applications.
A third glance began to get into the interesting ones. You can have a field object that shows the area of a circle, arc, polygon, ellipse, pline or spline curve. How would you like a building floor plan wherein the area annotations all update whenever you change the sizes of the rooms? No problem with fields.
Two Ways to Play the Field
You can insert a field in a drawing by using Insert / Field, or you can simply right-click in the middle of any text-creating command, including Text, Mtext, Leader, etc. A dialog box appears (figure 1).
![]() Figure 1. The Field dialog box shows some of the available fields. |
Note the partial list of available field names. You can scroll down the list to see them all, or you can drag the bottom edge of the dialog box downward so it expands to show the full list.
Making the Short List
![]() Figure 2. The field name filter drop list groups similar fields. |
When you select Date & Time, the Field Names list shows a shorter list of just those fields that relate to date and time, plus the center and right panels change to display a long list of the available format options. Let's take a look at the time and date options (figure 3).
![]() Figure 3. The Field dialog box with the Date & Time filter active. |
Before we look at individual cases, note two other points about fields. The first is that fields work equally well in layout mode (paper space) as they do in model space. The second point is that if you insert fields into a drawing and save the drawing as a template file, any new drawing you start from that template will already have the active fields. You can create standard title blocks that automatically show the creation date, the time and date the last time the drawing was plotted, and/or the last time it was saved.
Remember last month I said that most fields update when you regen? Well, obviously these three date fields do not, or they wouldn't mean much. The Date field just displays the date and time when it was inserted. It does not update on a regen. You must manually update it using the UpdateField command.
Moving right along, let's look at the fields under the Document category (figure 4).
![]() Figure 4. The Field names in the Document category. |
Let's start with Filename. Obviously a handy one to have in a title block, isn't it? It will always display the current file name, even if you Save As to a different name or if you rename it using Windows Explorer. As indicated in the upper right corner of the dialog box, you could have two different Filename fields in a title block; one would show the path and the other would show the specific file name.
Another interesting field in this category is LastSavedBy. Have you ever wanted to know who messed with a drawing and then saved it? Now you know who to blame. This field displays the Windows login name of that person. It is normally most meaningful in a network situation, because it will show the network login name. Stand-alone computers often default to Administrator. You probably want to set them up with a different local user for each machine so you can tell them apart.
The other fields in this category also look like prime title-block material, but you might wonder how AutoCAD knows the drawing title or what comments have been added. Just click on File / Drawing Properties to bring up the dialog box (figure 5).
![]() Figure 5. You can access the file Properties dialog box by fields. |
The dialog box has four tabs. I have selected the Summary tab to show the user-entered values that are available. Anything you manually enter or edit under this tab will show up in the appropriate fields.
The General and Statistics tabs show values that are accessible through fields but are automatically generated.
The Custom tab is an interesting one. We can create our own properties and enter our own values, such as a project or client name. When we do, the custom property we created turns up in the field names list! You can set it up in a template file so it is ready to go whenever we start a new drawing. An advantage of doing it this way is that the Windows Explorer search function can read the file properties, so we can easily find a misplaced file for a specific project.
Plotter's Field
I think you are beginning to get the general idea. I won't go through every remaining item, but here are a couple of highlights. For starters, the Plot category includes fields such as the login name of the user who plotted the drawing and the plot parameters, such as scale, paper size, orientation and so forth. The time and date of the plot were mentioned earlier when I discussed the Date & Time category.
The Sheet Set category is also very interesting. About 20 fields are related to sheet sets, so we can include suitable identifier annotations within a sheet and even cross-references to different sheets in the set. This category alone could easily be the subject of an entire article or three.
The Fine Print
Let's end with a few pertinent points about fields.
First, if a field is included within a block definition, then it effectively freezes to the current value when the block definition is created. On the other hand, if you insert a field as the default value for an attribute definition and then include the attribute definition within a block definition, it will update properly. Try a simple example of a block consisting of a circle along with an area field to see what I mean. If you include the field as part of an attribute definition, its value will change if you scale the block insertion.
By default, fields are displayed with a light gray background that does not plot. The FieldDisplay system variable will turn this background on or off. It is saved in the system registry, so it affects all your drawings.
Fields are just like any other Mtext object. If you double-click a field or text containing a field, it invokes the Mtext editor, as we saw last month. You can edit the text style, font, color, etc. If you double-click again on a field, it brings up the Field dialog box, so you can change it to a different field or change the units or time/date formatting.
Fields can be used within tables, which were new to AutoCAD 2005.
The Explode command will turn a field into normal text, freezing it at its value at the moment of explosion.
In conclusion, you see how easy it is to set up and use fields and how useful they can be in automating many documentation items in a drawing.
And Now For Something Completely Different. . .
When splitting firewood, rub the sides of the axe or splitting maul head with high-cling oil such as hypoid gear oil, motorcycle chain oil or chainsaw bar oil. This will make the wood easier to split because it reduces friction between the wood and the axe or maul.
For Mold Designers! Cadalyst has an area of our site focused on technologies and resources specific to the mold design professional. Sponsored by Siemens NX. Visit the Equipped Mold Designer here!
For Architects! Cadalyst has an area of our site focused on technologies and resources specific to the building design professional. Sponsored by HP. Visit the Equipped Architect here!