Recovering Corrupt DGN And DWG Files [CS]



  

This Client Server article is republished in its entirety from 2007 for reference purposes.

By Bentley Technical Support
12 June 2007 Modified: 10 September 2007


Have you ever said, "My deadline is tomorrow and my file won't open!"

You may be working on a design that is critical to your project. Last night it was fine. You saved it before you left, shut down your computer in an orderly fashion, and yet the file won't open today.

You may be able to recover all or just some of your work. Occasionally a file is so corrupt that all work is lost. This is an unfortunate occurrence, but can happen with any computer system and any file type.

A critical requirement: backing up

The most sure-fire recovery system is a backup scheme. For example, a weekly system backup schedule with daily incremental updates means that, at most, a day's work is lost when a file is corrupted. It should be a part of any business based on computer files. This cannot be stressed enough. If you have a day-old backup to fall back on, you can still make that deadline.

A variety of external backup systems is described here. You might also consider a USB external hard drive or a flash memory thumb drive. The latter are now available in verstions that store 8 gigabytes or more.

What, no backup?

What you do next depends on the file format and version of MicroStation it was created with. Consult the flowchart that corresponds to your file format.

If your file was created in MicroStation/J (V7):

If your file was created in MicroStation V8:


If your file is in DWG format:

Detailed instructions in each case follow:

Do you have the correct version of MicroStation to open the file?

MicroStation/J (version 7) files can be opened in that or any later version of MicroStation. For information about your file opening read-only in V8, consult the Help file to set the MS_OPENV7 configuration variable.

MicroStation V8 files can be opened in any of the V8 editions. Trying to open a V8 DGN in MicroStation/J usually results in a "Not a design file" error message.

Particular versions of DWG files require specific MicroStation versions to open. If you are unsure of the format of your file, look at it in MicroStation Manager. If it is supported, the version is displayed above the preview window. The following DWG file versions can be opened by the corresponding versions of MicroStation (or any later version).

R 2.6MicroStation V8.0/8/1
R 9MicroStation V8.0/8/1
R 10MicroStation V8.0/8/1
R 11/12Any V8 edition
R 13Any V8 edition
R 14Any V8 edition
R 2000, 2000i, 2002Any V8 edition
R 2004MicroStation V8 2004, MicroStation V8 XM Edition
R 200508.05.01.25 and later MicroStation V8 2004, MicroStation V8 XM Edition
R 2006MicroStation V8 XM Edition

 

Can you open the file in MicroStation V8 XM Edition?

MicroStation V8 2004 Edition can handle some corruption of elements and file headers in MicroStation/J files. It may allow you to open your file, write to it and save it; thus, fixing your file. MicroStation V8 XM Edition has this same capability for V8 files created in earlier versions.

If you are able to open your file in MicroStation V8 XM Edition, simply make a change and undo it. This will cause data to be written to the file.

Reference, then merge into new file

  1. Start MicroStation (preferably MicroStation V8 XM Edition, but any V8 version will suffice).
  2. Left-click the File drop-down menu in the MicroStation Manager screen.
  3. Select New.
  4. Set File Type to the type that matches the corrupt file.
  5. Give the file a name.
  6. Make sure the seed file is the proper type.
  7. Click OK.
  8. Click OK again.
  9. Reference in the corrupt file.

If the corrupted file doesn't display, move to the next pertinent section. If it does display:

  1. Detach all reference files from the corrupted file (they are now nested references).
  2. Left-click the File drop-down menu.
  3. Select Save As.
  4. Append "_01" to the filename.
  5. Make sure the Select Format To Save selection matches the file format of the corrupt file.
  6. Click Options (in the lower right-hand corner).
  7. Select the Reference tab.
  8. Left-click the External Attachments drop-down menu.
  9. Select Merge.
  10. Click OK twice.
  11. Reattach all reference files.

Import models into new file

  1. Start MicroStation (preferably MicroStation V8 XM Edition, but any V8 version will suffice).
  2. Left-click the File drop-down menu in the MicroStation Manager screen.
  3. Select New.
  4. Set File Type to the type that matches the corrupt file.
  5. Give the file a name.
  6. Make sure the seed file is the proper type.
  7. Click OK.
  8. Click OK again.
  9. Left-click the File drop-down menu.
  10. Select Models.
  11. Use Import Models to try to import the Default model from the problematic file.

If that succeeds, import the other models.

Command line verifydgn

If you are unable to open the file, run the verifydgn MDL application at the command prompt. It is best to run it through the Developer Shell. If a full installation of MicroStation was not done, then the Developer Shell will not be available.


With the Developer Shell installed:

  1. Copy the file to the ..bentley\program\MicroStation folder.
  2. Click the Windows Start button.
  3. Select Programs or All Programs.
  4. Click the MicroStation folder.
  5. Select MicroStation Development Shell.
  6. Browse to the
    ..bentley\program\MicroStation folder.

Enter USTATION -VERIFY FILENAME.DGN to verify that the file can be worked on.

Enter USTATION -VRG FILENAME.DGN
to repair the file.

Try to open the file in normally with MicroStation

With the Developer Shell not installed:

  1. Copy the file to the ..bentley\program\MicroStation folder.
  2. Right click on the icon used to start MicroStation.
  3. Select Properties.
  4. Select the Shortcut tab.
  5. Locate the Target field.
  6. Following the executable AND THE DOUBLE QUOTES (Example: ustation.exe") add a space, a dash (-), the word "VRG" and the name of the file. For Example:
    "javascript:void(null);" -VRG badfile.dgn
  7. Click Apply.
  8. Launch MicroStation using the modified icon.

DWG Recover

  1. Open any other design file.
  2. Left-click the Utilities drop-down menu.
  3. Select DWG.
  4. Select Recover.
  5. Browse to and highlight the DWG file.
  6. Click OK.
  7. A message box opens and specifies how many errors were found and how many were fixed.
  8. Try to open the file in a normally with MicroStation.

These steps should recover some, if not all of your data, but there is no guarantee. Again, always have a backup of the file in case the worst happens.

If your company does not have a backup plan in place, make backups yourself. Copy your files to a secondary or flash drive at the end of the day. You'll be glad you did.

See Also

Client Server Archive

MicroStation Desktop TechNotes and FAQs

Comments or Corrections?

Bentley's Technical Support Group requests that you please confine any comments you have on this Wiki entry to this "Comments or Corrections?" section. THANK YOU!