Automatic backup of design (DGN) files


 Product:MicroStation
 Version:08.11.09.459
 Environment:N\A
 Area:Archive / Backup
 Subarea:N\A

How can my design files (DGN) be automatically backed up so my file can be retrieved if any sort of corruption occurs to it?

Background

An MDL called "backup.ma" had previously been compiled for use in older versions of MicroStation which no longer seems to work in the current releases of V8i. This allowed for backups of your design files (DGN) to the folder defined using the configuration variable MS_BACKUP and various other settings. A simple method is required that allows for the automatic backup of the design file either when the file is opened, closed or both.

Steps to Accomplish

The key-in to perform a backup of your design file is BACKUP. This creates a ".bak" file which is a copy of your design file at the time this was performed. This ".bak" file is saved to the location that has been defined in your configuration variable MS_BACKUP. The following AskInga Article supplies a very good VBA macro that allows you to run key-ins when files are opened or closed called "AutoRun.mvba".

AskInga - Run a VBA Macro when opening or closing design files

Instructions are included on how to set this up so this macro AutoLoads.
You will see in the instructions that it has been setup to run specific key-ins when a design file is opened or closed. To change the key-ins used here just follow these instructions:
1.   Open VBA Project Manager from > Utilites > Macros > Project Manager.
2.   The "AutoRun" project should already be listed here and set to "AutoLoad".
3.   Double-click on this and it will list the macros available in this project.
4.   Select "OnProjectUnload" and click on the "Edit" button.
5.   This will open the VB Macro in the "Visual Basic Editor".
6.   To the left you will see "Modules" and "Class Modules". Expand both by clicking on the "+" sign.
7.   You will then see "clsDGNOpenClose", double click on the item.
8.   If you scroll down to the bottom of the central screen you will see a list of commands starting with "CadInputQueue.SendCommand". These have all of the key-ins listed that will run when opening or closing the file.
9.   Edit the command at the bottom from:

CadInputQueue.SendCommand "Reference Detach All"

To:

CadInputQueue.SendCommand "Backup"
10. You can also change the commands for "OnDesignFileOpened" to whatever you like.

From:

CadInputQueue.SendCommand "View Off All"    'Turn off all views
CadInputQueue.SendCommand "View On 1"       'Turn View 1 on
CadInputQueue.SendCommand "Window Tile"     'Resize View 1 to fit screen
CadInputQueue.SendCommand "Fit All"               'Start Fit All command
CadInputQueue.SendCommand "Selview 1"          'Apply to View 1

To:

CadInputQueue.SendCommand "Fit All"
11. Close Microstation and start it up again to get the VB macros working.
When you open a design file or close a design file it will perform these key-ins. That is, it should produce a backup file in the MS_BACKUP folder when you close the design file.
 

See Also

http://communities.bentley.com/communities/other_communities/askinga/w/askinga/managing-microstation-backup-directories

http://communities.bentley.com/products/microstation/f/141/t/15410

http://www.ozdata.com.au/index.htm?page=/products.htm

Other language sources:

Français

Deutsch

 Original Author:Andrew Bell