The FILTER Command-Your New Best Friend

31 Aug, 1998 By: Lynn Allen

filterSelecting objects is an everyday occurrence for all CAD operators. Shaving seconds off the selection set process can subtract minutes, possibly even hours over the time span of a project. Last month we discussed the many different options available at the Select objects: prompt. This month we'll cover a command that helps you quickly sift through your database of objects, enabling you to grab only the objects you want. If you've ever wanted to grab only a specific type of object (for example text or dimensions) or those objects that share a specific property (layer, color, elevation), then the FILTER command will become your best friend.

FILTER is one of those top-secret commands that's buried beneath the AutoCAD infrastructure. It's been with us for many releases, and many an AutoCAD guru uses it when no one else is looking. You can use a filter search that selects something simple such as all circles; or you can select a very specific filter that selects all circles with a radius of 2.3 that lie on the construction layer. Let's take a look at this treasure of a command so you too can select objects at light speed!

In R14, the FILTER command has been banished from the pulldown menus and is no where to be found in the toolbars either. (I didn't get a vote on this decision!) Don't let this dissuade you from using this cool command. You can always access it by keying FILTER in at the command prompt (it's also a transparent command). You'll also find that FILTER has been aliased to FI (it rated an alias but not a menu pick). If you find yourself wanting to use this command often-and don't like to type-you might consider making a FILTER toolbar button. The filter icon no longer exists in R14, but I'll include it on the CADENCE Web site for those of you who want to use it. For those of you still in R13, you'll find it in the Edit pulldown menu under Select objects..., as well as on the Standard toolbar under the Select window fly-out. (Note: Bad news for you AutoCAD LT users, there's no FILTER command in it. Sorry.)

As a simple exercise, I've drawn three lines and three circles. I've placed these objects on two different layers, and assigned the color yellow to two of the objects. I've drawn them very close together making it difficult to select them manually (not uncommon in standard drawing practices).

Let's say our goal is to select just those circles that are yellow in our drawing. The FILTER command makes this an easy task. Open the FILTER command and take a look.

Selecting the Filter
The first step in the process is selecting the filter(s) you want AutoCAD to use to sift through the data. We want two. We want AutoCAD to search for circles (filter 1) that are the color yellow (filter 2). Filters fall into three different categories: object (line, arc, pline and so on), property (layer, color, linetype) or individual object characteristics (text height, block insertion angle). Select the drop-down list on the left side of the dialog box by the word Arc. You'll find a substantial listing.

We'll select the Circle filter and then select the Add to List button located in the lower left-hand corner of the FILTER dialog. You'll find the line Object = Circle displayed at the top of the dialog indicating that we've chosen one filter. Some filters require additional information, such as layer name, size, hatch pattern type and so forth. Our second filter requires two bits of information. We'll select color first, then follow that by selecting exactly the color we're after. Notice the Select... button that is located next to the word Color. Choose this button and the color palette displays. After selecting the color yellow, we'll reselect the Add to List button. Both filters should display. After selecting the appropriate filters, pick the Apply button to save our filter list and then exit the dialog box.

You should find AutoCAD prompting you to Select objects. Put a window around all of the objects in your drawing and you'll find that AutoCAD only selects those objects that pass the filter list; they must be yellow and they must be circles. In my case, two objects are selected. These are stored in the current selection set. To use these objects, you'll enter a command and when prompted to select objects you can enter P for previous. AutoCAD will use only the yellow circles in the command.

It often makes more sense to transparently use the FILTER command inside of the desired command. For example:

Command: ERASE
Select objects: 'filter
Select your filters and pick Apply
Select objects: window all the objects
6 found; 4 filtered out.

This eliminates the need to use the Previous option in the command. Now, let's take a look at the other options in the FILTER command.

More Fun with Filters
It's possible to select a filter that requires a numeric coordinate or value, for example, all circles with a radius of 4. Notice the drop-down list of operators that exists under the equal sign. This permits you to suggest a filter list such as All the circles with a radius of less then 4. Below are the possible options:

!= Not equal to
< Less than
<= Less than or equal to
> Greater than
>= Greater than or equal to
* All possibilities (standard wildcard)

It should be noted that the != and * options are not documented. Test your local AutoCAD guru to see if he knows what these stand for!

Keep in mind that I seldom go to the trouble of using the asterisk, since all possibilities are assumed. For example, why would I select circles of any radius, versus simply all circles? I suppose you might find yourself in a situation where you have specific x and y coordinates but can accept any z value-or something along those lines.

You'll also find that if you choose a value such as Circle Center, the additional filter of Object = Circle will automatically be added to your list. Is it just me, or is the Y filter box slightly off center? I remember this from previous releases and it's apparently still not fixed.

And, Or and Not
You can make your filter list as simple or complex as you desire. Those of you with some programming experience will immediately identify with the And, Or and Not options. You'll find these additional operators at the end of the filter list.

For those of you who've successfully avoided the world of programming, I'll provide a brief and painless explanation:

Rule 1. You must have both a Begin and an End in your filter list. If you do not follow this rule, AutoCAD will call you bad names.
Rule 2. You must begin and end with the same type of operator. Begin Not, goes with End Not, Begin And goes with End And and so on. (Thou shalt not mix thy operators!)

Let's say you'd like all of the polylines that are cyan, or all of the polylines that are on the floorplan layer. This filter list would look something like this:

Object = Polyline
**Begin OR
Color = 4 - Cyan
**End OR

Notice how we diligently followed Rule 1 and 2. The operator Not is used to select all objects that do not pertain to the filter list. XOR is still a mystery to me. I believe it's a combination of And/OR and only accepts two operands.

The hottest button in the Filter dialog box is the Add Selected Object. This permits you to select an object with the characteristics and properties you're after and it will be used to determine the filter set. From there you can delete or modify the filter list to suit you. This dialog box still doesn't recognize the Shift or Ctrl keys as viable means to select multiple entries, so it can be a tad tedious.

Should you want to save a particular filter list, do so by selecting the Save As option and providing a name. This name will be saved to the file (named filter list-another good trivia question for your fellow AutoCAD gurus). You can also delete a filter list from the file with the Delete Current Filter List button. You'll find that you can Edit and Delete items. The Clear List button returns you to a clean slate as it removes all of the entries in the filter list (don't hit it by accident or you could lose some valuable time rebuilding your list). Substitute is used to replace one filter entry with another; to my mind, it's just as easy to delete and add an item.

Get creative with your filter lists and be sure to save those you use frequently. Using filters is one of the best mechanisms you have to save valuable selection time.

Finally, Silicon Valley CAD user Andy Hill had the misfortune to sit next to me on an airplane while I was working on my column (it's a small world!). He provided some great suggestions, and I'd hate to not give credit where credit is due. Thanks, Andy!

More News and Resources from Cadalyst Partners

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!