Application developers should review the source code for detailed comments on the classes, methods, and functions used. The code is divided into separate files to make reading easier.
The example application imodelVisitor, delivered with the MicroStation SDK, demonstrates the following use cases:
-
Run the Publish and Package process
-
There are a number of publish options controlled by the PublishOptions. The command IMODELVISIOR SET PUBOPTS with an unparsed argument can be used to provide settings. The format is OptionName:value, where the option name is FilterHistory, PublishDesignHistory, RepublishAll, CacheVisibleEdges and value is True or False.
-
There are a number of package options (e.g. removemodel, print, export, license, password, certificate, and expiration) controlled by PackageOptions. The format is OptionName:Value. To set the options, run the command IMODELVISITOR SET PACKAGEOPTS, sending the appropriate unparsed argument for the setting. The options are removemodel:On/Off, print:true/false, export:true/false, license:type (user/cert/pass), password:"password", certificate:certName:certRecipient, expiration:expiration date.
-
The publish operation is done by calling the imodelVisitor_publish function, which is attached to the IMODELVISITOR ACTION PUBLISH command. This publishes the active file and is the same as using the command in the host application.
-
The package is generated by calling the function imodelVisitor_package function, which is attached to the IMODELVISITOR ACTION PACKAGE command.
-
During the publish operation, there is a callback that can be set to either get or set the provenance of the i-model
-
See imodelVisitor_publish function where it calls the SetOverrideSourceEvent method. This method sets a function that is called during the publish process. This allows the caller to insert a new file provenance.
-
Processing Graphics and Business Data using the IMODELVISITOR ACTION PROCESS command.
-
Processing an i-model to read the graphics.
-
Process each graphic item in the model by iterating through the DGN cache
-
The graphics are processed by the static method ElementGraphicsProcessor::Process().
-
Applications need to derive a class from IElementGraphicsProcessor. See the MicroStationAPI help file for the details on this class.
-
The graphics options need to be set based on the type of element information that is required. See the documentation on IElementGraphicsProcessor for the details on setting the graphic types to process.
-
Processing an i-model to read the business data:
-
Get a reference to SchemaManager
-
Get a reference to the XmlInstanceAPI
-
From the element handle, get the list of instance information that is attached to the element
-
Process each entry in the list
-
Convert the string data to XML using the appropriate XML API (either MSXML or mdlXML)
-
To identify the Schema in the file, use the command IMODELVISITOR ACTION REPORT. This calls the imodelVisitor_reportSchema function, which detects the schema used in the file and produces an XML file.
The example application ExternApp, delivered with the MicroStation SDK, demonstrates the following:
-
Iterating and Querying the available remote Publishing Engine(s)
-
Connecting to a remote Publishing Engine
-
Communicating to a remote Publishing Engine ie: send information to manipulate the Publishing Engine, load application, send commands
-
Inter-process communication with a remote Publishing Engine (i.e. receive information back from the Publishing Engine via registered callback)