Original Article Date: Feb 14, 2001
Batch process can be run directly from the system command line by using a external process called MSBATCH. With this utility you can do several things depending upon the version of MicroStation you're using. For example, with V8 you can convert raster files, merge files, save to DWG, and replace cells.2003-11-19 Updated for clarity.2007-01-09 Reviewed and updated as necessary.2007-05-14 Updated V8 content.
MSBATCH is a delivered utility that runs from the command line and translates multiple files from one format to another. Although most commonly used with V7 MicroStation for converting AutoCAD drawing files into the V7 design file format, MSBATCH can also be used to:
Watch that syntax!MSBATCH is run from the directory that contains the executable and typically follows this syntax: MSBATCH [application] option1 option2 option3…. Although the syntax appears to be quite simple, the following should be kept in mind:
The Command Line Options:With some of the translators it's possible to obtain a list of the available command line options by keying in MSBATCH [application] from the system command prompt. This is true for: dwgin, dwgout, cgmin, cgmout, igesin, igesout, cnvdgn and repcell - although this isn't the case for all versions. Entering this keyin will display a table showing the valid parameters as well as an example of the syntax to be used.For instance, by keying in MSBATCH DWGIN, you will be presented with the following information in a DOS window:
GRD Import:In MicroStation V7 the grdin translator doesn't show the available options. In the event that you'd like to use MSBATCH to convert to this format, use following syntax: msbatch grdin [option1 option2 option3...] where: infile: [filename] Specifies files for import, overrides MS_GRDINoutgrd: [filename] Specifies output file name and directory, overrides MS_DGNOUTsettingsfile: [filename] Specifies settings file; overrides MS_GRDINSETFor example, to convert GRD Files in \temp to DGN files in \dgn, the command would read:msbatch grdin infile:c:\temp\*.grd outgrd:c:\dgn\GRD Export:In MicroStation V7 the grdout translator doesn't show the available options. In the event that you'd like to use MSBATCH to convert to this format, use following syntax: msbatch grdout [option1 option2 option3...] where: infile: [filename] Specifies files for export, overrides MS_DEFoutgrd: [filename] Specifies output file name and directory, overrides MS_GRDOUTsettingsfile: [filename] Specifies settings file; overrides MS_GRDOUTSETFor example, to convert DGN Files in \dgn to GRD files in \temp, the command would read:msbatch grdout infile:c:\dgn\*.dgn outgrd:c:\temp\Raster Image Conversion:Although you can use MSBATCH to handle multiple images, you may obtain better results and more control over output settings by using the Batch Conversion option delivered with the Raster Manager. Please refer to the delivered MicroStation HELP file for the specific syntax and available options.Merging Design Files Together:Let's say you need to merge a dozen or so files into one single destination file. You could attach them as reference files and then use the Fence Copy tool..but that method has it's problems. First of all it can be extremely inefficient and of course, there's always the risk of duplicating your active design file elements. With that in mind, let's take a look at using MSBATCH to merge files together.Say, we want to merge the entire contents of source1.dgn, source2.dgn and source3.dgn into dest.dgn.You can use the following syntax:msbatch merge [destination_filename] [source_filename_1]... [source_filename_n]For example, in both MicroStation V7 and V8, you'd use the following:msbatch merge dest.dgn source1.dgn source2.dgn source3.dgnOf course – the same results can be obtained by executing Merge from the MicroStation Manger > File menu.Replacing cells:To replace cells (excluding orphan cells) from the system command line, entermsbatch repcell.ma [DGN_file] [cell_library] [y | n] [cell_to_replace] [replacement_cell] where:DGN_file is the DGN file on which to operate,cell_library is the cell library that contains the replacement cell,y keeps attributes,n does not keep attributes,cell_to_replace is the name of the cell in DGN_file to replace, replacement_cell is the name of the replacement cell in cell_library.Convert 3D to 2DMSBATCH can be used to quickly convert 3D files to 2D or vice versa. To do so, use the following syntax:msbatch cnvdgn inname: outname:For example, to convert all files in C:\3D\ and place the resulting files in C:\2D\ the command would be as follows:msbatch cnvdgn inname:c:\3d\*.dgn outname:c:\2d\Remember to include the trailing back-slash at the end of the outname. In addition, the file names can't have any spaces and the output files can not be written to the same folder as the input files.Batch Process Job File:MSBATCH can also be used to kick off a MicroStation V8's Batch Process Job file by using this syntax:msbatch batchprocess [batch_process_job_file_specification]Note, when using MSBATCH to kick off a VBA application, ensure that the command includes MDL Load ustnvba at the beginning.With thanks to Russ Webber for providing this information.Batch Conversion Job File:You can run a job saved in a batch conversion job file (BCNV) directly from the system command line by using MSBATCH and the following syntax:msbatch batchconvert [batch_conversion_job_specification]Watch those settings:Before bulk processing any files, it's important to have fine-tuned your option settings and to have a good idea of what your end results are going to be. It's strongly suggested to test one or two files first and tweak the necessary settings until you have satisfactory results. After all, it would be a shame to process hundreds of files only to realize after the fact that your settings were incorrect.In addition, you many experience a limit to the number of files that can be included in one batch when using MSBATCH. This limit is related to the amount of system resources available and will vary from system to system. Typically, the more physical memory and swap space available, the more files you can include in a single batch process.Need more info?File Portability/Translation GuideUsing MSBATCHAnd of course the delivered documentation.
AskInga Article #52