Search

Batch Convert Utility TechNote

Support

<< Return to Index
Subject: Batch Convert Utility
Product: MicroStation V8
Operating System: Windows® 2000, Windows XP Professional, Windows XP Home Edition, Windows Me, Windows NT® 4 (SP6 recommended), Windows 98 (Second Edition recommended)
Document Number: 8242

Batch Convert is a new utility delivered as part of MicroStation V8. The Batch Convert application is used to convert individual files or entire directories of files from any of the CAD formats supported by MicroStation to any other supported format. File formats currently supported include MicroStation/J, MicroStation V8, AutoCAD DWG and AutoCAD DXF.

To start the Batch Convert Application, select the Utilities > Batch Converter… entry from the Main Menu. The Batch Convert dialog will appear (Figure 1).

 

Figure 1 BatchConvert dialog

Setting up a batch conversion job

In addition to DGN or DWG files, if the output format is set to V8, the first step in using this utility is to set up a Batch Convert job. Note that if the output format is set to MicroStation V8, you will be able to convert pre-MicroStation V8 cell libraries to the MicroStation V8 format. You can also browse for the destination directory using the Browse icon. If the directory entered does not exist, Batch Convert will create it when the job is processed.

Next, identify your conversion tasks by clicking on the Add Files or Directories icon. That brings up a file selection dialog (Figure 2) with a few additional features that are specific to the Batch Convert application.

 

Figure 2 Selecting files for batch conversion

This dialog allows multiple selection of both files and directories. The Add button automatically enables when a file or directory selection is made. Clicking this button adds the selected files or directories to the list displayed in the lower section of the dialog. If directories are selected and the Include Subdirectories toggle is checked on, the directory name is followed by the wildcard string, *\ to indicate that the subdirectories will be included in conversion operations.

When you have selected the files and directories that need conversion, click the "Done" button. At this point, the source files and directories are added to the table in Batch Convert dialog, with the output format and directory as selected in the first step. If the source, the output format or output directory for any row needs to be changed, the entries in the table can be directly edited to correct the data. Alternatively, the Apply to Selection button can be used to incorporate the default output format and directory from their settings at the top of the dialog.

If an entry in the source column contains a directory, it can be edited to include a standard file filter. For example, if you wanted to convert all the files with the extension .d04 from directory d:\007625\ and its subdirectories, the source column entry would read d:\007625\*\*.d04.

When an entry in the source column is a directory, all files from that directory that have an extension in the list defined by MS_BATCHCONVERT_COPYEXT will be copied to the destination directory. For example, if you want Batch Convert to copy all the files with the extension .rsc or .txt to your output directory, define MS_BATCHCONVERT_COPYEXT as rsc;txt. By default, MS_BATCHCONVERT_COPYEXT is not defined, and only files in one of the design formats are processed.

Notes on the use of Batch Convert

  • Different rows can have different output formats and destination directories.
  • The order of conversion is indicated by the sequence number column (which has the heading "#").
  • Rows can be removed from the conversion table using either the Remove Conversion selection in the Edit menu, or the Remove icon.
  • Conversions can be sorted by any of the columns, but the Edit menu options that modify the order are enabled only when sorting by the "#" column in ascending order.
  • If DWG or DXF files are involved as source files, the settings accessed through the DWG Open Options selection on the Edit menu are used.
  • If any files are to be output in those formats, the settings accessed through the DWG Save Options selection on the Edit menu are used.
  • The Log file Options selection on the Edit menu is used to set a log file and to specify whether it should be emptied prior to conversion processing.

Saving and recalling Batch Convert jobs

If you plan to perform file format conversions more than once, you should consider saving your batch convert setup as a "job." To do this, click the Save Batch Convert Job icon or select the Save option from the File menu. The default extension for batch conversion job files is .bcnv. Once you have saved a batch conversion job, you can recall it by clicking on the Open Batch Convert Job icon or selecting Open from the File menu. The DWG open and save options, the log file name and all conversion tasks are saved to the batch conversion job file. The batch conversion job file is a text file similar to Windows initialization files and can be edited with a text editor, if desired (Figure 3).

 

Figure 3 Typical batch conversion job file

Processing Batch Convert jobs

When the batch conversion job is set up as desired, the conversion process can be started by clicking on the Process Batch Convert Job icon or selecting File > Process... from the main menu. If you want to convert only a portion of the job, select the rows that are to be processed and turn on the Process Selections Only toggle.

When the conversion is started, a dialog appears displaying a list of the files to be converted and the progress of the overall conversion job (Figure 4).

 

Figure 4 Batch conversion status dialog

Notes on Processing Batch Conversion jobs

  • If the source format is the same as the output format, the source file is simply copied from the input location to the output directory.
  • When feasible, Batch Convert uses the source file name for the output file. When the source is in MicroStation/J or MicroStation V8 format and the output is an AutoCAD file, the output extension is automatically set to .dwg or .dxf as appropriate. If there are multiple files with the same root name (differing only in extension) in the source directory, the extension is incorporated into the output file name. This is due to the fact that all AutoCAD files must have the .dwg or .dxf extension.
  • Batch Convert checks to see if the output file exists, and, if so, whether it is the same date as the source file. If so, it does not bother to convert or copy the source file to the output.
  • The file time of the output file is set to match the file time of the input. This feature makes it feasible to run the batch conversion application for a job frequently, updating the output versions of only those source files that have changed. It also makes it possible to restart a batch conversion job. When the destination file is up to date, the Status column indicates that fact.
  • When the conversion process is started, the Convert button automatically changes to "Pause." Clicking Pause directs Batch Convert to pause after converting the current file. The button then changes to Resume. The application never stops in the middle of converting a file.
  • If MicroStation/J or MicroStation V8 files are being converted to AutoCAD files, and the Save References As DWG/DXF toggle in the DWG Save Options is turned ON, then the references of each file are processed, as well as the master file. In certain instances, this results in the automatic conversion of some files that are in the batch conversion job before they are reached in the table. In such a case, the Status column will change to Already Converted when the batch conversion process reaches such a file.
  • When the conversion process is finished, the Convert/Pause/ Resume button changes to read Done, and the Cancel button is disabled. Clicking Done closes the dialog.
  • Clicking the Cancel button stops the batch convert job after the current file is finished.
  • As files are converted, the status of the conversion is displayed in the Status column, and the time required for the conversion or copy is displayed in the Time column.
  • Details about the conversion process are written to the log file. This log file can be opened using any text editor, such as Notepad.
  • When the conversion process ends, the log file table can be sorted by any column. In particular, it can be quite useful to sort by the Status or Time fields.

Running Batch Convert without graphics

If desired, the batch conversion application can be run from a Command Shell. To use Batch Convert in this mode, first create and save a batch conversion job in the manner described above. Next, exit MicroStation and open a Command shell. The easiest way to do this is to use the MicroStation V8 Development Shell option in the MicroStation program group.

From the Command shell prompt, enter the command:

msbatch batchconvert <batchconvertjobfile>

where <batchconvertjobfile> is the full file specification of the batch convert job file. In this case, progress messages are output to the MicroStation console window. These messages are also written to the log file.

8242

batch convert

How useful was this page?
less
  more
Suggest new content or let us know how we can improve this content (optional):

<< E-mail this page