Clean up your mess with the Filter command

31 Jul, 2000 By: Bill Fane

It was a wet, rainy May evening in Vancouver, and the forecast called for more rain. Captain LearnCurve mused that there would be no water skiing again tomorrow. Some things never change. Suddenly, a distressed wail drifted through the gloom: Woe is me! Several people worked on this drawing, and now it’s impossible to edit! Some object properties are bylayer while others have their color and linetype properties set independently. When I freeze a layer, I never know what will disappear and what won’t.

Yes, some things never change. As I preached last time, it is almost never correct to set object properties that are different from the layer on which they reside. Still, many users persist in doing so. On the other hand, AutoCAD objects are quite easy to change. As we saw last time, this can be the source of the problem. All you do is select some objects, then click the Color or Linetype box in the standard Object Properties toolbox, select a color or linetype, and, presto, the change is made!

The good news is that you can use this same technique to fix other people’s messes.

So far so good, but I have hundreds of objects to correct, scattered all through the drawing. Is there an easier way to select them?

Of course there is, or I wouldn’t have brought it up.

Figure 1. The Filter command presents this dialog box.

Find that Filter command
Earlier AutoCAD releases provided a menu pick for the Selection Filter. The menu pick disappeared in Release 13 and later, but the Filter command still works at the Command prompt. When you type in the Filter command, the dialog box shown in figure 1 appears. The Filter command is extremely versatile and powerful, but some of its details are not quite intuitive.

Your usual first step is to pick the down arrow beside Arc near the middle of the left side. This pulls down part of a scrolling list of all the things you can filter for. Scroll down to Text and pick it.

Now click the Add to List button. The phrase "object = text" appears in the upper window of the dialog box.

Next, select Apply. The dialog box disappears, and you are asked to Select objects. You can use all of AutoCAD’s standard selection set mechanisms, including picking, window, crossing, add, remove, and all. Note the magic that occurs—anything that is not text is filtered out of the selection set!

If you type All in response to the request to select objects, AutoCAD selects your entire drawing, including objects off-screen or on layers that are off. It ignores objects on frozen layers.

Now that you have a selection set of all text objects, simply go to the Object Properties toolbar to move all the selected text to the correct layer and to set its color Bylayer.

Filter’s many layers
Filter lets you search for a lot more than just the type of object. When you select the type of filter, scroll down to Text Height and select it. Now the X= window activates so you can type in a value. You can click on the down arrow to the right of this window and select a relative operator. For example, you can filter for all text that is less than (<) 1 unit tall, circles greater than a specific radius, and so on.

You can filter for a particular text style, a specific text value, and so on. There is a gnarly bit here, however. If you filter for things such as layer names or dimension and text styles, you may not see any place to enter the desired text value. The solution is just a well-kept secret. If a filter needs a text value, the X= window activates and displays the last numeric value used. You are supposed to know to replace this X=number with the desired text. Not quite 100% user-friendly, is it?

Filter also lets you perform Boolean searches for cross-combinations of objects. Once you start a filter list, you can then go back and select more filter definitions and Add to List. Note that by default the total list is an AND function, so you can select all objects that are circles AND their color is red AND their radius is larger than 3.000. Obviously, an AND list must be logical. You can’t use Filter to select everything that is a line AND is a circle.

The good news is that if you scroll down to the bottom of the Select Filter list, you find a series of Boolean functions. Note that they are in pairs, and that an end must match a start.

For example, to find all lines and all circles, our filter list would look like this:
** Begin OR
Object = text
Object = line
** end OR

Here is a very useful filter list.
** Begin NOT
color = 256
** End NOT

You must enter colors by AutoCAD color number. Color 256 is actually bylayer. This list thus finds all objects whose color is not bylayer.

You can also nest Boolean operators, providing the begin and end codes match.

Figure 2. The standard Modify Properties dialox box.

Save and repeat
So far so good, but I have a number of filter combinations to apply to each of a large set of drawings. Must I define all of them each time?

Of course not. Just go to the right-hand side of the Filter dialog box, type in a suitable name of up to 18 characters, then select Save as. This writes the current filter definition out to disk in a file called FILTERS.NFL. The location of FILTERS.NFL is determined by the drive and directory specified by the Start In box defined in the properties of your desktop icon that launches AutoCAD.

From now on, any drawing you open will have the full selection of predefined filters available. Simply click on the down arrow beside Current and select the one you want.

I have just touched on the highlights of filtering. A bit of playing reveals that you can delete items from the current list, or edit them, or delete named sets from the saved filter list.

Oh, thank you Captain LearnCurve! You’ve saved my life!

Faster Filter
But wait! There’s more! AutoCAD 2000 added a really cool feature, one of those top-secret things hidden out in plain view.

Figure 3. Filter’s Quick Select variant is not quite as powerful, but it’s easier to use than the full-fledged Filter option.

Figure 2 shows the standard Modify Properties dialog box from AutoCAD 2000. Note the button with the funnel and yellow blob icon near the upper right corner. Click on it, and up pops figure 3. This is Filter’s Quick Select variant. It’s not quite as powerful as Filter, and you can’t save filter settings, but it is very quick and easy to use.

Your choices under Apply To include the current selection and the entire drawing. You can pick one each of Object type, Property, Operator, and Value. You can Include In or Exclude from the current selection set or a new one.

When you select OK, AutoCAD automatically builds the selection set and feeds it to the still-open Modify Properties dialog box. From here you can easily change the properties of the selected set, as discussed last time.

As we have seen, changing the properties of AutoCAD objects is very easy, and by using filters we can just as easily fix up the properties problems created by others.

If I could just figure a way to get the Change functions to work on my granddaughter’s diapers.

And now for something completely different
If your landlord won’t let you keep pets, no problem. First, get a stuffed toy cat and curl it up in a sleeping pose on your favorite chair. Now, simply empty a can of cat food per day into a litter box. Let it sit for a while and then scoop it out, and there you have it. A virtual cat.

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!