Multiline Text
The TEXT command can be used to add multiple lines of text, yet each text object is added as a separate object. Often, you want to add multiple lines of text as a single object. In such cases, you need the MTEXT command, issued by choosing Multiline Text from the Draw toolbar or from the Text submenu of the Draw pull-down menu.
After you start the MTEXT command, you are prompted to select the first corner point of a window. This window is used to determine the point where the mtext object will exist. By default, the mtext object is created with a top-left justification. If you want, you can change the justification type to one of eight others: TC (Top Center), TR (Top Right), ML (Middle Left), MC (Middle Center), MR (Middle Right), BL (Bottom Left), BC (Bottom Center), or BR (Bottom Right). These justification types are similar to those available with the TEXT command (refer to Figure 14.5), except that they apply to the whole mtext object and not just a single line of text.
You then indicate the desired width of the mtext window. A width of zero disables the automatic word wrap feature of the Text Formatting dialog box. With that setting, you must press the Enter key when you want to start a new line of text.
Several other command line options appear, but many of these are easier to set through the Text Formatting dialog box (see Figure 14.9). The Text Formatting interface is divided into two parts. The bottom part is the editor, and the top part controls the properties, which are described in detail in later sections.
Figure 14.9 The Text Formatting dialog box.
Creating Mtext Objects
Previous versions of the Text Formatting editor were somewhat crowded with icons and tabs. It was revamped in AutoCAD 2004 and reduced to the bare essentials needed to produce text. The plethora of options still exists, however, and the options are now located in the right-click shortcut menu. As shown in Figure 14.10, there are many options related to creating mtext that can be taken advantage of.
NOTE
Several options, Line spacing and Rotation, are still only available at the command line before the dialog box appears.
Figure 14.10 The right-click shortcut menu has many features, as well as several submenus.
In the following exercise, you learn about the various aspects of creating and editing mtext objects.
Exercise 14.1 Using MTEXT to Create Paragraphs of Text
-
Open the drawing 14EX01.dwg from the accompanying CD. It contains several predefined text styles that we will utilize.
-
Start the MTEXT command by choosing the Multiline Text tool from the Draw toolbar. AutoCAD reports at the command line: Current text style: "Standard" Text height: 0.2000
-
At the Specify first corner prompt, go ahead and pick the upper-left corner mark.
-
Similar in nature to the TEXT command, you adjust the size of the text, its justification, and other properties prior to entering the editor. We pass on this now; go ahead and specify the opposite corner by using the lower-right corner mark. The Text Formatting dialog then appears.
-
Within the editor window, type the following note:
-
After typing the note, it is obvious that the current font is rather unappealing. Use the Style drop-down list and select Romans. Instantly, the text within the editor changes appearance to that of the Romans font.
This indicates which text style is current and what height will be active in the editing dialog.
TIP
The little text sample attached to the cursor is adjustable. Normally it reads abc, but you can change the MTJIGSTRING system variable to whatever you would like it to read.
After you pick the first corner, you then are permitted to make changes to the current mtext settings, as shown in the prompt:
Specify opposite corner or [Height/Justify/Line spacing/Rotation/Style/Width]
TIP
The AutoCAPS item on the right-click menu permits you to leave Caps Lock off, yet type text in the editor window in uppercase letters.
6x1/2 CONT. EMBED PLATE WITH 3/4 DIA. x 5 LONG H.S. @ 24 O.C. (STAGGER LOCATIONS OF STUDS WITH BRIDGING ANCHORS)
Depending on how your system is configured, as you typed the note, you may have gotten the AutoStack Properties dialog, as shown in Figure 14.11. This dialog enables you to control how your fractions should appear and enables you to "set it and forget it." Select your preference; the examples used here are similar to the Architectural style of drafting.
Figure 14.11 The AutoStack Properties dialog box is where you can tweak your fraction's appearances.
TIP
If you need to adjust the AutoStack Properties dialog settings and have instructed it to not show again, you can still get to it. Highlight an existing stacked fraction and, using the right-click shortcut menu, choose Properties. Then on the Stack Properties dialog box, as shown in Figure 14.12, choose the AutoStack button to gain access once again.
Figure 14.12 The Stack Properties dialog box enables custom stacking styles to be applied to an individual fraction.
NOTE
The other drop-down list to the right of the Style drop-down is Font. It is not related to the Style control; in reality, it is similar to a dimension override, enabling specific portions of the mtext object to use another font. It should only be used if you must have a differing font embedded within the rest of the text.
Your multiline text is now complete. Press the OK button to close the Text Formatting dialog box. You should now have a text object that looks like Figure 14.13.
Leave this drawing open for the following exercise.
Figure 14.13 A typical mtext object.
This short exercise exemplifies the ease of use of the Text Formatting interface. Although the control area of the dialog is available, facilitating immediate changes to text properties, productivity can be gained by presetting the various properties prior to actually showing the interface. Some of the controls are also available through toolbars and system variables.
Customizing for Text Styles
AutoCAD 2005 comes with two toolbars for creating and manipulating text objects. Shown in Figure 14.14, the Styles toolbar contains a drop-down list for setting the current text style. Also shown in Figure 14.14 is the Text toolbar, which has tools to create single and multiline text as well as other editing features.
Figure 14.14 Toolbars available to control, create, and edit text and mtext objects.
System variables affect the creation of text objects and their preset properties (see Table 14.4). These can be used in your customization methods to speed setting up your environment.
Table 14.4 Text Formatting System Variables
System Variable |
Description |
TEXTSIZE |
Sets the text height for all new text-based objects created. |
TEXTSTYLE |
Sets the current text style. |
After you begin to customize your AutoCAD environment, you can take advantage of ways to set to specific properties and start the MTEXT command in one click. The following menu macro is an example:
^C^C_.-style;romans;romans.shx;;0.8;;;;;
When executed, this creates the text style Romans, assigning ROMANS.SHX to it and leaving all properties except for width set to 0 or off. The width factor is set to 0.8, providing a slightly narrower text style:
^C^C(setvar TEXTSIZE (* (getvar DIMSCALE) (getvar DIMTXT)))
This short AutoLISP code first retrieves the current DIMSCALE value, which is used to control how large the parts in a dimension object appear. The code then gets the current dimension style text height, multiplies these two together, and applies that size to the system variable TEXTSIZE. Click this button, and the next time you create text, it will match your current dimension style appearance.
Customization such as this can be placed within your Custom menu, on a Tool palette, or on a toolbar, or it can even be coded as small AutoLISP programs. As you develop the formatting specifics, you will learn where best to house them for the greatest effectiveness.
Editing Multiline Text
Very often, you will have to change the content in a mtext object. Early versions of AutoCAD required the user to erase the text and re-create it. Luckily for you, editing isn't that bad now. Just as easily as you create the content, you can later edit it as needed.
Exercise 14.2 Editing Mtext Objects
Continue from the previous exercise. If needed you can open the drawing 14EX02.dwg from the accompanying CD. It contains a single mtext object and some reference polylines.
Double-click on the mtext object, utilizing AutoCAD's double-click editing feature. The MTEDIT command starts, and the Text Formatting dialog box appears.
Locate on the top line CONT. and highlight the period. Then type INUOUS, eliminating the abbreviation. You probably noticed that a few words moved down to the next line. That's a key feature of mtextword wrapping.
Now highlight the word PLATE. Using the right-click shortcut menu, choose Symbol and select Property Line. The word PLATE is then replaced with a new AutoCAD 2005 PL symbol.
Next, locate the word DIA. and highlight it. Use the right-click shortcut menu and select Symbol. At the top of the Symbol submenu, select Diameter %%c. It doesn't look like much now; you will have to wait until the command ends.
Locate the O.C. and highlight it. Again use the right-click shortcut menu and select Change Case. Select lower case to change the case for the ON CENTER reference.
Click the OK button to close the editor. You can also click outside of the editing window to end the command.
-
You have edited the mtext object. You should also notice that the %%c now represents a diameter (Ø) symbol, as shown in Figure 14.15.
Leave this drawing open for the following exercise.
TIP
As you work with the MTEDIT dialog, you may notice it moves around to located itself over the text being edited. If this functionality is bothersome, you can use the MTEXTFIXED system variable to eliminate that activity. When turned on (1), the dialog enables you to place it on-screen wherever you want, and it displays there until moved. Additionally, turning this system variable on makes the editor background match the display background color. When off, the dialog background is translucent to show objects behind it.
TIP
You can also use Ctrl+Shift+U or Ctrl+Shift+L to change selected text case to upper or lower, respectively.
Figure 14.15 The edited mtext object with new text content and symbols.
There are a few specialty character combinations used by AutoCAD, as described in the following section.
Specialty AutoCAD Symbols
You can add symbols that are in the font file but that are not on the keyboard. Table 14.5 shows several formatting codes and the resulting symbols.
Table 14.5 Additional Formatting Codes
Formatting Code |
Symbol |
Meaning |
%%c |
Ø |
Diameter |
%%d |
° |
Degree |
%%p |
± |
Plus/minus |
The codes are not case-sensitive. In addition to the codes in Table 14.5, you can enter the code %%nnn, where nnn is a three-digit integer, to add any character in a font file.
AutoCAD 2005 comes with a series of new symbols. Shown previously in Figure 14.10, these new symbols require that you use new AutoCAD 2005 versions of SIMPLEX and ROMANS files as well new ISOCP and ISOCT series files.
CAUTION
In the previous exercise, if you change the font file to Arial, for example, the PL symbol becomes undefined and represents itself as small square. Due to this characteristic, caution should be taken when using new AutoCAD 2005 symbols with drawings that will be used by others who may not be on the same release.
A much easier way to add a symbol is to use the Windows Character Map program. To use the Character Map program in place of the %%nnn code, simply start the Character Map program by selecting Other on the Symbols submenu and select the TrueType font file you have specified in the current text style. Then select the character you want to add and copy it to the clipboard. You can then paste the character into the text you are typing.
CAUTION
Not all font files contain the same characters, which is why it is important that the font file you choose to copy from in the Character Map program is the same font file specified in the text style you are drawing with in AutoCAD. What the Character Map program actually copies when you copy a character to the clipboard is the character's position number in the font chart. When you paste that character into AutoCAD, the character corresponding to the position number recorded in the clipboard is drawn. Therefore, if you are using a different font file in AutoCAD, you may end up with a different character altogether.
MTEDIT Right-Click Shortcut Features
As you have discovered, there are many options available on the MTEDIT right-click shortcut menu. The following sections discuss some of these features in detail.
Insert Field
Fields are a new AutoCAD 2005 feature for embedding dynamic text values within text-type objects such as mtext. Refer to Chapter 21, "Using Fields and Tables," for more information.
Indents and Tabs
With the addition of indentation and tab stops, using AutoCAD as a limited word processor is easier than before.
As shown in Figure 14.16, the highlighted row of text in these notes is utilizing both features. It has an tab stop to push the 2. text over. It has another tab stop to push start of the REDUCTION text over. It then has an indent for all lines after the first one, helping it line up with the previous line.
NOTE
There is a dialog specifically for setting indents and tabs. Accessed from the Text Formatting right-click shortcut menu, choose Indents and Tabs, showing the Indents and Tab dialog.
Figure 14.16 Indents and tab stops in mtext aid in alignment.
TIP
You can adjust your indents within the editor window; just grab the appropriate indent marker and slide as desired. The top marker sets the first line indent; the bottom marker sets the indent for the rest of the paragraph. You can also place new tab stops by clicking on the ruler. Remove tabs by clicking on one and dragging it off the ruler.
Justification
After you are in the Text Formatting dialog, you can still change text justification if needed. The Justification submenu contains all available alignments for mtext objects. Just click the placement type you need, and the content of the editor instantly updates.
Find and Replace
Use the Find and Replace feature to search for a specific combination of characters and even to replace the text found with different text. If the Match Case setting is enabled, AutoCAD finds only text that exactly matches the case of the search string. If the Whole Word setting is enabled, AutoCAD finds only words that fully match the search string; otherwise, other words that contain the search string are located. After you specify the settings you want, use the Find button to start the search.
Stack and Unstack
The Stack/Unstack option is an slick feature in AutoCAD 2005 that is used to stack or unstack selected text. For example, you can designate selected text to be stacked by using special characters between the characters you want stacked. The text to the left of the character is placed on top of the text to the right of the character. To unstack stacked text, select it and then click the Unstack option.
AutoCAD 2005 provides for three stacked text types based on which of the following characters is used:
Carat (^). Converts selected text to left-justified tolerance-style stacking.
Forward slash (/). Converts selected text to center-justified text separated by a horizontal bar.
Pound sign (#). Converts selected text to a fraction-style stack separated by a diagonal bar.
You can edit stacked text and change the stack type, its alignment, or the size of stacked text in the Stack Properties dialog box, shown previously in Figure 14.12.
Import Text
If you have text in an existing TXT or RTF file, you can use the Import Text button to import the file into the editor, and then you can edit the text as needed. Click this option and then simply locate the text file to bring in. The content is read and placed within the editor at the current cursor location.
Background Mask
A great new feature in AutoCAD 2005 is text masking. Basically, this provides the capability have a colored background property applied to your mtext object. In addition, this mask can display the background of your screenessentially blanking out other drawing content that may exist within the mtext object boundary.
Setting the Bold, Italic, and Underline Text Properties
The Bold and Italic buttons enable you to bold or italicize the text, but only if the chosen font file is a TrueType font. You can use the Underline button to underline any selected text, regardless of the font file used. All three buttons act as toggles, and you can turn their properties on or off by simply selecting the desired text and clicking the appropriate button.
TIP
If you are using an SHX-based font, you can use the oblique angle to achieve the appearance of italics.
Color Settings
The Text Color list enables you to set the color for selected text. You can set the color to ByLayer, ByBlock, one of AutoCAD's 255 colors, or a True Color or Color Book setting.
Secondary Editing of Mtext Objects
You can use grips to move or change the width of the mtext object. When you select the grip point that corresponds to the justification point, you can move the mtext object. If you select any other grip point, you stretch the width of the mtext object. The following exercise shows the ease with which other mtext properties can be changed.
TIP
A new object snap opportunity exists in AutoCAD 2005. Now the corners (same locations as the grips) can be targeted using the Node osnap mode. Primarily used to align the corners or edges with other objects, this feature can be controlled through the OSNAPNODELEGACY system variable. When set to 0, it is active; when set to 1, AutoCAD does not provide nodes for an mtext object.
Exercise 14.3 Modifying Mtext Objects
-
Continue from the previous exercise. If needed you can open the drawing 14EX03.dwg from the accompanying CD. It contains a single mtext object and two reference polylines made in the previous exercise.
-
Double-click on the mtext object, invoking the MTEDIT command.
-
Press Enter to create a new line. Then move the cursor back up to the top line and type NOTE:. Then select that new text and then press the U (underline) button.
-
Highlight (if needed) the NOTE: text and, using the Font drop-down list, select Arial. It is near the top of the list. Choosing it changes just the selected text to that font.
-
Now the Bond font property is available. Select it to make the NOTE: bold.
-
Select the NOTE: text (if needed). In the size list, type in 0.25, making the text noticeably bigger than the rest of the text.
-
Again, with the NOTE: text selected, use the Color drop-down list and pick red. Now the added text is bigger and more distinctive.
-
Use the right-click shortcut menu and select Background Mask. The Background Mask dialog box is presented. Turn on the Use background mask option, and leave the other settings as shown in Figure 14.17. Close the dialog. Press OK to close the Text Formatting dialog box.
-
Draw a line from one corner mark to the other mark.
-
Select the mtext object so that its grips are activated. Then use the right-click shortcut menu and choose the Draw Order submenu, Bring to Front option.
Notice that the Bold font property is unavailable. The current style's font does not include a bold component.
Figure 14.17 You can set an mtext background color with the new Background Mask feature.
You didn't see a visible change to the background of the mtext object. This is partly due to the fact that the background color and the mask are identical. To truly appreciate this feature, you need something to hide.
Again, no change. This is because the last object drawn is on top of previous items drawn. But that is easily corrected.
Instantly, the line is now hidden by the area of the mtext object, plus a little bit more. Notice in Figure 14.18 that the corner mark is also being clipped. This clipping is handled by the border offset factor, as shown in Figure 14.17.
You can close this drawing without saving.
Figure 14.18 The revised mtext object, hiding all objects behind it.
NOTE
It should be noted that the entire mtext boundary box is the space that gets filled with the mask. As the bottom line content shows, even though the text doesn't extend very far, the boundary masks that area. Also note that the Draw Order command is crucial to implementing this feature well. A given mtext object can mask all other things, including other mtext objects and dimensions that are below it in the draw order.
TIP
Even geometry that is masked is still there, selectable and available.
Line Spacing Controls
Shown in Figure 14.19 is a portion of the Properties palette with the mtext object from the previous exercise selected. Most text properties can now be managed through the right-click shortcut menu found within the Text Formatting dialog box. A few exceptions exist, including the line spacing properties.
Figure 14.19 Mtext-related spacing features on the Properties palette.
The default Spacing Factor is 1.0, which sets the line spacing as a multiple of the single line spacing. Single spacing is 1.666 times the text height in most cases. The Space Distance value follows the factor value, but it shows the value as a true distance. For example, text with a height of 0.20 has a default distance of 0.333 (0.20 x 1.666).
The combination of these two settings enables the mtext object to have a minimum spacing while the Line Spacing Style is set to "At least." If characters go above or below the line, such as a [ or /, the lines adjust to maintain proper clearance. However, if you need a specific line spacing, for a schedule perhaps, you can set the Style to Exact and then the Spacing Distance to your desired setting.