Jonathan Jonas sent us this tip about fully purging a file. Purge All doesn't purge all! It came to my attention this morning after dealing with screen glitches in AutoCAD 2008 and trying to figure out what might be causing them, that when you do a Purge All at the command line, it does not really do a purge all. Instead, it purges 11 of the 12 purgeable types of objects. What does not get purged are the Registered Applications that are embedded within a DWG file. For years now I've used the simple line below to do Purge All for all my drawings:
(Defun C:PUA () (Command "PURGE" "A" "*" "N"))
However, now that I know this doesn't work, I've adjusted the simple code to force AutoCAD to truly purge everything with the following changes to the code:
(Defun C:PUA () (Command "PURGE" "A" "*" "N")(command "purge" "r" "*" "n"))
I would suggest that others who also have their own versions of a Purge All command take a second look at theirs to be sure they have them modified to encompass the full purge command.
Notes from Cadalyst Tip Patrol: I didn't believe this tip at first, but it is true; sorry for my lack of faith. Purge All does not purge Registered Applications or Xdata. These can bog down a file. They get there from inserting or referencing other files that have these applications in them. If you don't have a custom purge button, routine, etc., then the only way to get to this option is by typing in –purge on the command line. You need the hyphen so that the dialog box won't open and it is a text-only interface. Type in R for Registered Applications, and so on. Running the purge command this way can help clean up a file. If you have a custom button for the purge command using Diesel (in a toolbar, ribbon, or pull down menu) here is the code to run the above tip:
This routine was tested in AutoCAD 2009.