CADconform Logo

CADconform for MicroStation
Readme

Forward Back

 

CADconform Server API

Batch Processing

CADconform can perform batch processing in the background, without the need for the user to open MicroStation. This can mean a report can be triggered from another application, or scheduled as a task to be automated at a regular interval using the Windows Task Scheduler. Additionally, design files can be certified or signed outside of MicroStation. All of the settings for the batch processing are stored in the Report Job file (*.REPJOB), including which design files to process and also whether you want to report, certify or sign the design files.

 

Syntax

CADconform batch processing can be performed from the command line by either:

  1. Calling MSBATCH
  2. Calling the ustation.exe directly

Both the "msbatch.bat" and "ustation.exe" files exist in the MicroStation program folder directly. In MicroStation V8i, this location is usually by default:

C:\Program Files\Bentley\MicroStation\

To run the commands, the user needs to open a DOS window and change to this active directory.

The first method using the batch command "msbatch.bat" provides a slightly simpler interface, though it does require that the default MicroStation workspace is used. This batch file itself invokes "ustation.exe", so functionally there is no difference between using them. The syntax for calling CADconform through msbatch is as follows:

C:\PROGRA~1\BENTLE~1\MICROS~1>msbatch cadconform j<REPORT_JOB_FILE> [l<LOG_FILE>] [certify]

The second option is the preferred method, as it gives the user more control over the command line options used to invoke MicroStation, which is particularly useful for defining the workspace. The syntax for calling ustation.exe directly is:

C:\PROGRA~1\BENTLE~1\MICROS~1>ustation.exe -WAcadconform -ij<REPORT_JOB_FILE> [-il<LOG_FILE>] [-iCERTIFY] [DESIGN_FILE]

NOTE: There is no space between the "J" and the Report Job File!

Note that the msbatch method invokes ustation.exe with the "runwait" command, meaning that control does not continue until the task completes. If you want to perform the API commands synchronously (for example, you want to write a batch file to perform each step at a time), then you can invoke the ustation.exe with the runwait command by preceding "ustation.exe" with "runwait".

The commands specific to CADconform are:

Command Switch Syntax Example using MSBATCH Example using ustation.exe Purpose
j j<JOB FILE PATH> jC:\temp\test.repjob -jC:\temp\test.repjob Defines the report job file to use (mandatory)
l l<LOG FILE PATH> lC:\temp\test.log -lC:\temp\test.log Defines the log file to output (optional - defaults to $(CADCONFORM_LOG_FILE))
certify certify certify -icertify Certifies the design files (optional - defaults to reporting if unspecified)

When invoking ustation.exe directly, other standard MicroStation command line arguments can be used. Some of the more common ones are listed below. These can be added in any order:

Command Switch Syntax Example using ustation.exe Purpose
wc wc<CONFIGURATION  FILE PATH> -wcC:\CAD Build\MicroStation V8i Config.cfg Defines a configuration file to read on startup
wa wa<MDL APPLICATION> -waCADconform Defines an MDL application to run on startup
wu wu<WORKSPACE USER> "-wuGlobal Conform.ucf" Specifies the workspace user as "Global Conform"
wp wp<WORKSPACE PROJECT> -wpElectrical.pcf Specifies the workspace project as "Electrical"

If a particular MicroStation workspace or configuration file is required for running in the background, then the latter method must be used. For example, if you are working in an electrical discipline and the required levels are only available when you are in the project named "Electrical", then this project must be specific on the command line using the ustation executable path rather than MSBATCH. Some more examples follow:

NOTE: If a file name or path contains a space, the entire command switch must be surrounded by double-quotes,
e.g. "-wuGlobal Conform"





 

Examples

Start by opening a command window and changing to the MicroStation executable directory:

CD C:\Program Files\Bentley\MicroStation

 

To run a report job named "Mine-01.repjob" through MSBATCH:

MSBatch CADconform JC:\Reports\Jobs\Mine-01.repjob


To run a report job named "Mine-01.repjob" through MicroStation directly:

ustation.exe -waCADconform -iJC:\Reports\Jobs\Mine-01.repjob

 

To certify using a report job named "Mine-01.repjob" in the workspace project "Electrical":

ustation.exe -waCADconform -wpElectrical -iJC:\Reports\Jobs\Mine-01.repjob -icertify

 

To run a report job named "Mine-01.repjob" in the workspace project "Electrical" and user configuration "Piers":

ustation.exe -waCADconform -wpElectrical -wuPiers -iJC:\Reports\Jobs\Mine-01.repjob

 

To run a report job named "Mine-01.repjob" and read in a configuration file "C:\My Settings.cfg":

ustation.exe "-wcC:\My Settings.cfg" -iJC:\Reports\Jobs\Mine-01.repjob

If there is a space in the report job path, make sure the whole argument is in quotes:

ustation.exe "-wcC:\My Settings.cfg" "-iJC:\Reports\My Jobs\Mine-01.repjob"

 

 

Setting Up The Batch Processing Command

To use batch reporting on any CADconform client machine, the following workflow should be followed. 

  1. Start by logging into CADconform as a CADconform Server Administrator interactively through MicroStation.
  2. Open the Batch Processor, and set the Report Options as well as the Advanced Options as required for your report. (See the online help for more information on what the options are for).
  3. Select the required design files, reference files and levels as required.
  4. Select the offline mode you would like for your batch processing in the "Options > Report Job Defaults To" menu. You can choose either "Reporting", "Certifying" or "Signing".
  5. Save the current settings as a Report Job file ("File > Save As...") and exit MicroStation. You are now ready to test the batch reporting.

 

Testing the Batch Report

Open a DOS prompt and key in:

CD <MSPATH>

followed by:

MSBatch CADconform J<REPORT_JOB_FILE>

Where <MSPATH> is the MicroStation path where "MSBATCH.BAT" is located and <REPORT_JOB_FILE> is the pathname of a Report Job file. 

There will be a delay while CADconform generates the report.

 

Viewing the Results of a Batch Report

As with running CADconform Server interactively, the batch reporting writes the reports to the Report Database. These reports can be viewed by either:

a) Opening them in your database application.

b) Opening them using the CADconform Server "Report Viewer".

c) Using the "Automatic Report Exporting" options (in the Advanced Options > Output Options dialog) to create text file reports.

The reports are written to up to 6 different tables, as described below:

Report Type Database Table Name Purpose
Report Information "Report_Inf_ReportName" Contains information on who created the report, when and how many errors
Design File Information "Report_Dgn_ReportName" Contains information on each design file checked, and which levels were used
Individual Error Report "Report_All_ReportName" Contains each instance of an element that didn't match any known CAD features
Error Summary Report "Report_Sum_ReportName" Contains a summary of the errors in the Individual Error Report
Feature Summary "Report_Fea_ReportName" Contains a summary of every element in the design file
Watermark Status Report "Report_Wat_ReportName" Contains the certification status of watermarks in each design file

More information on the columns of each table can be found in the CADconform Server Reference manual.

 

Viewing the Error Log

CADconform Server keeps track of any errors or problems that would otherwise be displayed in a message box to the user if they were running the report in interactive mode. This error log information is stored in two places:

  1. A text file as defined by the value of the MicroStation workspace configuration variables "CADCONFORM_LOG_FILE". By default this usually expands to:
        $(APPDATA)\Altiva Software\CADconform Client\Log Files\batch report.log
    For example:

        "C:\Users\Piers Porter\AppData\Roaming\Altiva Software\CADconform Client\Log Files\batch report.log".
  2. A database table named "Log_BatchReport", located in the same database as the reporting database.

An example of the contents of a typical batch report log table is given below:

 
Report_Number User_Name Action_Date Description
31 Piers Porter Fri Dec 13 14:40:35 2002 Importing feature tables 'Pspid' from datasource 'piers1'
32 Piers Porter Fri Dec 13 14:40:36 2002 Watermark report disabled: user does not have watermark privilege.
33 Piers Porter Fri Dec 13 14:40:36 2002 Overwriting report: 'piers' belonging to user 'Piers Porter'
34 Piers Porter Fri Dec 13 14:40:40 2002 Number of files processed = 3 Number of files conformed = 0 Number of files failed = 3 Total number of errors = 1252

The text file report log can be useful as a backup error log, if, for example, there was an error attaching to the report database; since an error log table could not be created without a database connection. It can also be useful to display the contents easily within a 3rd party application.

 


Copyright 2001-2011 Altiva Software, Inc. Last modified by Piers Porter.