Optimizing drawing files in AutoCAD with Purge, Audit & Recover

Autodesk Support

Sep 25, 2024


Products and versions covered


Issue:

AutoCAD or AutoCAD vertical (.DWG) file corruption can be seen through one or more of the following symptoms:
  • File will open with errors.
  • File hangs or crashes AutoCAD.
  • Slow performance when opening, editing, and manipulating the file.
  • Error messages when working in the file.
  • Commands do not work or there is considerable delay in operation.
  • Unexplained file size increases.
  • Display/Regen problems.
  • Drawing elements missing or shown incorrectly.
  • Objects cannot be selected consistently.

Causes:

File corruption can be introduced in numerous ways, some examples are listed below:
  • Third-party applications running inside AutoCAD.
  • DWG files created or saved by non-Autodesk or non-RealDWG products.
  • AutoCAD terminated while saving the drawing.
  • Old drawings used repeatedly over long time periods.
  • Network anomalies (transmission errors, file locking, latent writing of data).
  • Storage media degradation (bad sectors on a hard drive).

Solution:

Use the following drawing utilities to remove unused geometry and correct drawing database errors. The commands can be found under the Application menu Drawing Utilities:
  • AUDIT (Command)  - Evaluates the integrity of a drawing and corrects some errors.
  • RECOVER (Command)  - Repairs and then opens a damaged drawing file.
  • PURGE (Command)  - Removes unused items, such as block definitions and layers, from the drawing.
  • -PURGE (Command) > RegApps  - Removes RegApps from the drawing (available from the command line only).
Drawing Utilities menu

The listed commands can be used individually or in combination for maintenance and error-checking. The two methods shown in the following examples will perform the same tasks, although method 2 which uses Recover as opposed to Audit will do a more thorough job in detecting and fixing errors:

Method 1: 

  1. Open the drawing file.
  2. Audit and fix any errors:
    1. Type AUDIT on the command line.
    2. "Y" for Yes to fix any errors, then Enter.
  3. Remove unused named objects from the drawing:
    1. Type PURGE on the command line.
    2. Enable all checkboxes checked on.
    3. Click Purge All.
  4. Purge Registered Applications (from the command line):
    1. Type -PURGE.
    2. "R" for Regapps (registered applications), then Enter.
    3. "*" , then press Enter (the asterisk equates to All).
    4. "N" asked to verify each name to be purged, then Enter.
  5. Save the drawing.
Note: Step 3 executes the dialog version of the Purge command, whereas step 4 uses the command line equivalent. This is because the option to purge Regapps is only available from the '-Purge' command.
Both steps 3 and 4 can be executed from command line. For step 3 use "All" to purge all entities.
Command: -PURGE
Enter type of unused objects to purge [Blocks/DEtailviewstyles/Dimstyles/Groups/LAyers/LTypes/MAterials/MUltileaderstyles/Plotstyles/SHapes/textSTyles/Mlinestyles/SEctionviewstyles/Tablestyles/Visualstyles/Regapps/Zero-length geometry/Empty text objects/Orphaned data/All]: A
Enter name(s) to purge <*>:
Verify each name to be purged? [Yes/No] <Y>: N

Repeat the command:

Command:  -PURGE
Enter type of unused objects to purge [Blocks/DEtailviewstyles/Dimstyles/Groups/LAyers/LTypes/MAterials/MUltileaderstyles/Plotstyles/SHapes/textSTyles/Mlinestyles/SEctionviewstyles/Tablestyles/Visualstyles/Regapps/Zero-length geometry/Empty text objects/Orphaned data/All]: R
Enter name(s) to purge <*>:
Verify each name to be purged? [Yes/No] <Y>: 
Note: to reduce RegApps inherited from XREFs in the future, consider setting XREFREGAPPCTL = 1

Method 2:

  1. Close the drawing file.
  2. Recover and fix any errors:
    1. Type Recover on the command line.
    2. In the Select File dialog, select the problematic file.
    3. Once error-checking is complete the drawing will open.
Note:
  • Depending on the number of errors checked, it's good practice to use SAVEAS, renaming the drawing and keeping a copy of the original file. Then closing the file and run Recover again on the newly saved file.
  • When working with a host drawing file and it's referenced files, use the RECOVERALL command to error check the references. 
  1. Remove unused named objects from the drawing:
    1. Type PURGE on the command line.
    2. Enable all checkboxes checked on
    3. Click Purge All
  2. Purge Registered Applications (from the command line):
    1. Type -PURGE
    2. "R" for Regapps (registered applications), then Enter
    3. "*" , then press Enter (the asterisk equates to All)
    4. "N" asked to verify each name to be purged, then Enter
  3. Save the drawing

Method 3:

For AutoCAD 2012 and later versions, the PURGE and RECOVER command can be performed simultaneously by using the DWGCONVERT utility. This utility can also be used to batch perform these procedures on many drawings at the same time.
  1. To start the DWG Convert utility, either:
    • With any drawing open, enter the DWGCONVERT command.
    • With no drawings open, click the application menu and select DWG Convert.
  2. In the DWG Convert window, click Conversion Setups.
  3. Click New and enter a name for the Conversion setup.
    • Optionally, select a Conversion setup other than Standard from the drop-down list to base the new Conversion setup upon.
  4. In the Modify Conversion Setup window, select the Check and fix errors and Purge drawings options.
Modify Conversion Setup window
  1. Set other conversion options as needed.
  2. Click OK and then Close.
  3. Load files to clean up by either:
    • Clicking the Add file icon and browsing to the files.
    • Dragging-and-dropping the files from Windows Explorer to the Files tree area.
  4. Select the newly created Conversion setup from the right box.
  5. Click Convert and follow other instructions as applicable, depending on the Conversion setup settings.
 
 

Products:

AutoCAD for Mac; AutoCAD LT for Mac; AutoCAD Products;


Was this information helpful?


Need help? Ask the Autodesk Assistant!

The Assistant can help you find answers or contact an agent.


What level of support do you have?

Different subscription plans provide distinct categories of support. Find out the level of support for your plan.

View levels of support