Application of wildcard characters with different tools and commands in AutoCAD.
Wildcards are special characters (for example, the asterisk “*”— also known as a “star”) that represent one or more characters in a string of characters. It was first popularized by search functionality for a variety of operating systems. AutoCAD supports most of the popular wildcard characters natively, including many useful applications with AutoCAD drawings. The following table lists wildcard characters used in this article with their description.
Wildcard
|
Description
|
# (pound) |
Matches any numeric digit. |
@ (at) |
Matches any alphabetic character. |
. (period) |
Matches any non-alphanumeric character. |
* (asterisk) |
Matches any string, including the null string. It can be used at the beginning, middle or end of a string. |
? (question mark) |
Matches any single character. |
For a list of all supported wildcard characters in AutoCAD, see this page on the Autodesk knowledge network. In this article, I will show you six uses of wildcards that can greatly enhance your productivity with AutoCAD.
Using Wildcards to Find Drawings
You can use the built-in AutoCAD file browser to search for drawings in a local or network drive by using wildcards. The biggest advantage of using wildcards for search is that you need not remember the full file name when searching. You can also search for multiple similar files, strategically using wildcards to quickly find the right CAD data.
To search for a file, launch AutoCAD and type OPEN on the command line. Press enter to open the file window. You can also use CTRL+O as a shortcut to open the file window. Click on Tools on the far right of the file window and select Find… from the drop-down menu.
The Find window will pop up as shown in Figure 1. Now let’s assume we want to locate all drawings with the word “foundation” in their name. Type *foundation* in the Named field of the Find window. In this wildcard string, the * symbol before and after “foundation” indicates that the file name can have anything before and/or after the word foundation.
From the type drop-down menu, select the file type which you want to search. Available file types include DWG, DXF, DWT and DWS. You can also specify a directory path where you think the drawings are present. If at all possible, try to narrow down the directory path for a faster search. Checking the radio button indicating “include subfolders” includes all subfolders below the specified directory path in the search. Once you have made all of these settings, click on the Find Now button. Depending upon the amount of data in the selected directory, the search may take some time. The result will then be displayed in the Find window.
If need be, you can further narrow your search by using multiple wildcards. For example, if you want to search for drawings that contain both the words “foundation” and “bay” in their name, use the wildcard string *foundation*bay* in the name field.
In the above example, * indicates that the file name must contain both words but can contain any characters prior to “foundation,” after “bay” and also in between the two.
Using Wildcards with the Find and Replace Tool
You can use wildcards to find and replace multiple text strings in your drawing as well. Let’s take, as an example, a drawing where some Mtext elements are named “XYZ mounting AA,” where XYZ can be any random text string and AA represents a two-digit numeral value. In order to change all of these text strings simultaneously such that the word mounting is replaced by Fixture in each instance, we will use the following steps:
Type FIND on the command line and press enter; the Find and Replace window will pop up. Expand this window by clicking on the arrow on the lower-left corner. From the search options panel of the Find and Replace window, select the Use wildcards radio button. In Find what field enter “??? mounting ##”. This wildcard string will tell AutoCAD that the first three characters can be anything, followed by a space, the word mounting, another space and finally two numeric characters.
Click on the Find button and you will see a list of all texts on the drawing that match the wildcard. Select the text instances in the list that you want to replace, and type the replacement text in the Replace with field and click on the Replace button. You can select and change multiple text strings from the list by pressing and holding the CTRL and SHIFT keys.
Using Wildcards with Quick Select
You can also use Quick Select to select multiple text strings with a recognizable pattern. Let’s assume that in the sample drawing discussed above, we have a large number of Mtext strings and we want to select all MTEXT strings containing the word “mounting.” In that case, the following steps can be applied.
Type QSELECT on the command line, and press enter to open the Quick Select window. From the Quick Select window, select Entire drawing in the Apply to drop-down menu and then select MText in the Object type drop-down menu. You will then see all available properties of the Mtext object type in the Properties panel. Select Contents from list of properties, and pick * Wildcard Match from the Operator drop-down. Now, in the Value field, type *MOUNTING* and click on OK to make the selection (see Figure 2). The Quick Select window will close, and all mtext strings containing the word “mounting” will be selected. QSelect is case sensitive, so make sure you use the correct case in the value field. In the wildcard specified above, the * symbol before and after “mounting” indicates that the characters before and after “mounting” can be anything.
Figure 2. Quick Select window.
Using Wildcards in Layer Search
This feature will be especially helpful if you want to quickly find specific layers from a long list of layers in your drawing. When you open the Layer Properties Manager, you will see a search field in the top-right corner of the palette. You can directly enter a wildcard string in this field to search among layers. Let’s assume that we want to locate a layer with the word “line” in its name. Directly enter *line* in the search field to search for any layer containing the word “line” anywhere in its name.
Layer name search in the Layer Properties Manger palette.
Using Wildcards with Layer Filters
We can create a layer property filter by using wildcard characters to sort similar types of layers. For example, to make a property filter in such a way that it displays all layers containing the word “wall” starting with the third character, a wildcard can be used.
Open the Layer Properties Manager from the layer panel in the home tab of the drafting and annotation workspace. Then click on New Property Filter icon in the top left of the Layer Properties Manager palette to open the Layer Filter Properties window. Enter a name in the Filter name field (e.g., “wall filter” or something else that you will remember) and then click on the Name column in Filter definition panel and type ??wall*. This wildcard string will tell AutoCAD to filter layers containing any two random characters at the beginning of the layer name, followed by the word “wall” and random characters at the end of the layer name. Once completed, click on OK to close the Layer Filter Properties window.
Layer Filter Properties palette.
Using Wildcards in Design Center
You can use wildcards in Design Center to search for drawings and named objects in drawings, such as blocks, line types, layers, etc., without having to open the respective drawing. Let’s assume that we have many drawings in a folder and some drawings contain some blocks named A-door-1, B-door-2, etc. If we want to find each drawing containing these blocks, we can use the following method.
Press CTRL+2 on the command line to open Design Center. Click on the search button located on top of Design Center palette. A search window will pop up. In this window, select Blocks from the Look for drop-down and then specify a folder where you want to search for blocks. Then in the Search for the name field, type ?-door-#. This wildcard string will tell AutoCAD to search for blocks in the specified folder with a name that starts with a random character followed by the word “door” encased in hyphensand a single-digit numerical value at the end. Once you have specified the wildcard, click on the Search Now button. All blocks with names that match the wildcard will appear. In a similar way, you can use wildcards to search for other named objects as well in Design Center.
Search in Design Center.
Conclusion
Wildcards are great for searching for named objects containing specific text strings in AutoCAD, as the functionality can be used with a variety of commands and tools. Although only six helpful wildcard uses have been described in this article, there are many more places where wildcards can be used. I encourage you to explore more applications of wildcard features yourself in AutoCAD.
About the Author
Jaiprakash Pandey is a corporate CAD trainer and designer currently working with the consulting engineering group Ramboll. He is an AutoCAD-certified professional as well as an Autodesk Expert Elite member and a mechanical engineer. Pandey also develops video courses for many online tutoring platforms and occasionally writes for AUGIWorld Magazine. You can reach him on his blog,