Original Article Date: Dec 19, 2001
This article, also written by Barry Bentley explores the new utility in MicroStation V8 called Batch Convert. This application is used to convert individual files, or entire directories of files from any of the design file formats supported by MicroStation to any other supported format.
The MicroStation Batch Convert Application:Batch Convert is a new utility delivered as part of MicroStation 08.00.01.xx. The Batch Convert application is used to convert individual files, or entire directories of files from any of the design file formats supported by MicroStation to any other supported format. File formats currently supported include: MicroStation V7, MicroStation V8, AutoCAD DWG and AutoCAD DXF. To start the Batch Convert Application select the Batch Converter... entry located on the Utilities pulldown menu. The Batch Convert dialog box appears:
Setting up a Batch Conversion Job:The first step to using this utility is to set up a Batch Convert Job. Select the output format desired using the Default Output Format combo box, and select the output directory by entering it in the Default Destination text field. Note that if the output format is set to V8 you will be able to convert pre-V8 cell libraries to the V8 format. You can also browse for the destination directory using the browse icon. If the directory entered does not exist, Batch Convert will attempt to create it when the job is processed.Next, add your conversion tasks by clicking on the Add Files or Directories icon. That brings up a file selection dialog with a few additional features that are specific to the Batch Convert application.
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 box. 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, press “Done”. At this point, the source files and directories are added to the table in Batch Convert dialog box, with the output format and directory as selected in the first step. If the source, 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:
Saving and Recalling Batch Conversion 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.
Processing Batch Conversion 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 the Process... option from the File menu. If you want to convert only a portion of the job, select the rows that are to be processed and turn on Process Selections Only toggle. When the conversion is started, a dialog box appears that displays a list of the files to be converted and the progress of the overall conversion job.
Running the Batch Conversion application 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:ustation –wabatchconvert –iwhere 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.
AskInga Article #93