Dealing with corrupt CAD files 

 

It is not uncommon to find that an AutoCAD or IntelliCAD drawing will not load (into the drawing editor). The software will usually report 'corrupt file' at some stage of the 'load'.

The following discussion offers some suggestions for possible recovery of the drawing. It is adapted from From CADnews (Nov/Dec 1999) and the the prime credit must go to the original author.

The issue described here are covered in more depth in our CAD workshop series.

Possibility 1. The drawing opens but the software locks up

If you can open your drawing, but the software locks up shortly after and reports a corrupt file, try using the XREF command immediately the drawing loads and detaching all X-REFs.

It is a good idea to type the command directly at the keyboard rather than via a drop down menu or toolbar item. That is make the XREF and detach option the very first thing that you do!

This may be your only problem, your drawing may be trying to resolve what are known as circular X-REFs. This will sometimes happen if you have been sent a drawing file from another consultant who is collaborating with you on a project.

At the end of the XREF detach procedure, it is useful to use (& repeat several times) the AutoCAD PURGE command until its repetition finds no further unreferenced objects. 

Note that if you have entities in papers pace, you will have to do the PURGE procedure twice, once in model space & once in paper space - then reassemble the drawing by inserting the cleaned model space & paper space entities into their respective spaces. Be aware that when you insert your paper space viewports back into paper space, the viewports will be off by default & must be turned back on.

Possibilty 2. The drawing opens but locks up when you start to draw

Try using the WBLOCK command to write out a fresh copy of the drawing. Load the new drawing and try it.

If that does not work, try using the DXF command to write out a DXF file from the drawing which will contain all drawing geometry. These files are text files and are unlikely to be corrupt. Then start a new drawing (from scratch) and use the DXFIN command to reconstitute the drawing.

Possibility 3. The drawing opens but locks up when you go to print

If you can open your drawing, but the software locks up when you try and print the drawing, first make sure that you are not sending the drawing to a 'phantom' printer i.e. one that is not available (like a network printer attached to a computer which is not turned on).

If that does not fix the problem, try using the WBLOCK command to write out a fresh copy of the drawing. Load the new drawing and try it.

If that does not work, try using the DXF command to write out a DXF file from the drawing which will contain all drawing geometry. These files are text files and are unlikely to be corrupt. Then start a new drawing (from scratch) and use the DXFIN command to reconstitute the drawing.

Possibility 4. Seriously corrupt files

The RECOVER command can be used to repair a damaged drawing. If AutoCAD or IntelliCAD determines that a drawing you're opening is damaged based on the drawing's header information, OPEN automatically repairs it. 

It is well worth trying to use the RECOVER command on the troublesome file from the drawing editor of a brand new drawing. The RECOVER command (in ACAD2000) is found via the file menu: Drawing Utilities Recover or (better in this circumstance) typed directly at the keyboard.

In the Recover Drawing File dialog box, enter the drawing file name or select the damaged drawing file. AutoCAD begins recovery and displays the results in the text window.

When FILEDIA is set to 0 (zero), RECOVER displays the following prompt on the command line.

Enter the name of drawing file to recover.

Enter ~ (tilde) at the prompt to ignore FILEDIA and display the Recover Drawing dialog box.

Use a .BAK file

If the RECOVER command cannot open the file, one must fall back on a backup. AutoCAD and IntelliCAD always produce a .BAK file whenever you save a file. It always has the .BAK extension with the same prefix as your corrupt drawing. You need to rename this file and give it a .DWG extension before you can work on it.

Note: The backup may have unnoticed corruption & should be run through the procedures set out below. I recommend the procedure below even if you load a (RENAMED BAK file) and the AutoCAD AUDIT command finds no errors. 

In some cases a file which cannot be saved with the recover command can be saved by opening a new "START FROM SCRATCH" document and using INSERT to insert the corrupt file into a new one. Usually AutoCAD can recover a file and the procedure below should be followed. If you have used INSERT to recover your file that the RECOVER command could not repair, you should also proceed with the next step for assurance that the file has been cleaned to the maximum extents possible.

Note here that steps 2 & 3 can be reversed as to order. If possible start with this step & the DXFOUT command. Let's use the name house.dwg as an example. Create a DXF file (using the defaults in the command) from the bad file - the file name can be the same with the DXF extension (house.dxf). Now use the FILE/NEW command & assign a name that can be anything such as deleteme since we are not going to save the file. It is important to use no prototype. Now issue the DXFIN command & bring in the house.dxf file we just created. ZOOM EXTENTS & then ZOOM .9X so you can see everything.

Thaw, turn on, and unlock all layers. WBLOCK out this file. When you are asked what to block out, use a selection window. A selection window is better than typing "all" or using the "*" option because it will get rid of stray entities that you don't want as null text. The file name you create with WBLOCK could be house01. Now we can again use FILE/NEW with a no prototype environment - we should give this new file a name that reminds us it will be the new clean one - how about house02? When asked to save our deleteme file, check NO. If you have objects in paper space, you will need to do a separate WBLOCK for those objects. If you were not able to DXFOUT in step 2 go back & do so now. Then you will be ready for the final step…..

This step is important even though you wouldn't think so. Our house01.dwg has been through both DXFOUT/IN & WBLOCK out, but let's do one last cleansing step. We are in an empty house02 file that was started from a null prototype. Use INSERT to insert our house01 into the present house02.dwg. When doing this insertion choose the option to explode house01 while you are in the INSERT dialog box. Also it's best to clear the check box for "SPECIFY PARAMETERS ON SCREEN" & let ACAD insert your house01 at point 0,0 or set the insertion point as desired. This house02.dwg is now as clean as it can get. At this point we can explode the house01 block we have just inserted & start to PURGE. When we finish purging, including purging out the house01 block, our current house02 is squeaky clean.

From CADnews (Nov/Dec 1999)

Recommendation:

Use AUDIT at the end of every drawing session.