Many dialog-based AutoCAD commands have a corresponding command line version. But why use the command line version of PURGE, you might ask? I will give you some compelling reasons.
How’s this for a start… Did you know you have an extra option in the command line version? No doubt any CAD manager knows about it, but it’s relatively obscure otherwise. The additional purgeable item is called Regapps. If your drawing file is experiencing performance issues, purging Regapps is on a CAD manager’s go-to list of things to do.
I know, I know. Your next question is, “What’s a Regapp?” Without getting too deep into it (it’s never wise to put your readers to sleep), files or programs that contain “Extended Entity Data” (or XData) write a tiny bit of code called a Registered Application in your drawing file to easily retrieve the data it needs. When the file or program, along with its XData, is removed, the Regapp remains.
OK – wake back up. Here’s the problem with that. You won’t notice any issues if you have just a few hanging around. But if you’re in an environment where these are common, you can easily collect thousands of these things. In fact, it’s not uncommon to hear tales of users finding tens or even hundreds of thousands of Regapps in a drawing. Fun fact: the most I’ve ever heard of is 256K.
Back to the Regapp option in -PURGE. Up until recently, that was the only way to remove them. The workflow goes like this: Call the -PURGE command, Type R for Regapps.
Accept the asterisk to specify that you want to get them all. Finally, (and this is very important) say “No” to the prompt to verify each one. Trust me. If you have a lot, after about the tenth time entering “Y” to the prompt, you’ll hit Escape, start over and specify “No.” You’re welcome.
Needless to say, these little snippets of code are quite infectious. While using -PURGE works great for one drawing, there’s now a better solution for batch processing. If you go here, you can download the Regapp Cleanup Utility, which works in AutoCAD 2021 and above. If they’re a problem for you, the utility will be well worth your time.
In my little monograph on Regapps above, I provided two other tips. One is using a wildcard, in this case, the asterisk. You can check out my post here for more wildcards and their use. The other is not to verify each object. Rarely will you want to do that. At least, I don’t.
Finally, the -PURGE command also lends itself to being included in scripts or macros. It’s super easy… in fact, here’s how to do it.
-PURGE
ALL
*
N
That wasn’t so difficult, was it? Here’s the weird thing, though. The ALL option doesn’t include Regapps! So, if you want to ensure they’re included (which they should be), you’ll need to run the -PURGE command a second time, substituting R for ALL, of course.
So next time you’re maintaining your drawing’s health, add purging Regapps to your repertoire. Whether you do it manually, via a script, or with the add-in utility, perhaps you, too, will find a noticeable improvement in your drawing’s performance.
More Tuesday Tips
Check out our whole Tuesday Tips series for ideas on how to make AutoCAD work for you. Do you have any favorite AutoCAD tips? Tell us in the comments!