Page Contents
We created the MicroStation Data Connector in response to questions posted to the Be Communities Forums, usually the VBA newsgroup.
Q Here are some common questions posted, where someone wants to exchange data between MicroStation and some external data source such as a database or spreadsheet …
A
The MicroStation Data Connector is an answer to those questions for MicroStation V8.5 and earlier.
It's an OLE-DB compliant COM Automation server,
meaning that you can reference it from any COM-compatible programming language, including VB and VBA.
Its fundamental strength is to convert MicroStation tag data into an ADO Recordset.
Because of changes in the underlying Microsoft technology, the MicroStation Data Connector does not work with MicroStation XM or later. If you are interested in similar technology for MicroStation V8i or later, please contact LA Solutions.
The MicroStation Data Connector treats a set of tagged elements analogously to a database table of rows and columns. Each row represents the tags attached to a host element, and each column of that row represents an individual tag.
If you are developing a MicroStation VBA (MVBA) project the MicroStation Data Connector is irrelevant. In that case, you are already connected to MicroStation. The MicroStation Data Connector is intended for use with VB, or a VBA project in a non-MicroStation application such as Microsoft Excel.
The MicroStation Data Connector is an OLE-DB compliant COM server aimed at VB and VBA developers.
It interprets MicroStation design file elements tagged with a specified Tag Set as an ActiveX Data Object (ADO) Recordset.
In other words, you can treat MicroStation as a data source. ADO makes it easy to query data from a source,
and navigate the records conveyed in the Recordset.
The analogy with a relational database table is simple: a Tag Set contains a number of Tag Definitions,
which are equivalent to the column definitions of a relational database table.
The MicroStation Data Connector scans a MicroStation design file for tagged elements, and presents the
resulting data as a Recordset.
The MicroStation Data Connector provides read-write access to tag data.
Based on the row/column model, this ActiveX component provides GetAt and SetAt methods
that read and write tag data attached to a host element.
It also reads tag data from a design file into a Recordset, but there's
currently no way to update the tags from the Recordset.
The MicroStation Data Connector uses the MicroStationDetector. It provides similar methods to start MicroStation, specifying a user workspace, project workspace, and design file.
To use the MicroStation Data Connector in VB or VBA you must add a reference to the DLL from your VB project …
If you installed the MicroStation Data Connector from the setup
installation, the DLLs are already registered. The following step is not required.
If you installed the MicroStation Data Connector from the setup
installation, the DLLs are already registered. The following steps are not required.
To register the DLL as an Automation server …
MicroStationDataConnector.DLL is located regsvr32 MicroStationDataConnector.DLLWe've provided a sample VB (VB6, service pack 6) project that shows how to use the MicroStation Data Connector. It pops a form having various buttons that test the MicroStation Data Connector in different ways.
If you are using Visual Basic, open the References dialog from the Project|Properties menu. Browse the list of Automation servers to find the LA Solutions Data Connector for MicroStation, check the box, and click OK to finish …
We've provided a sample Excel spreadsheet, MicroStationDataClient.xls, that shows how to use the MicroStation Data Connector in
a VBA macro (press Alt-F11 to pop the VBA IDE).
The supplied file has a worksheet with a button MicroStation Data Connector.
This starts MicroStation, if not already running, and attempts to find any Tag Sets in the
specified design file. A sample file, tags.dgn, is provided. The macro populates an
area of the spreadsheet with data extracted from MicroStation tagged elements.
A ComboBox lists the available Tag Sets in the DGN file. When you choose a different Tag Set, the
VBA re-queries the DGN file for tagged elements, and writes their values into the spreadsheet.
The sample Excel spreadsheet, TitleBlock Example.xls, has named cells that correspond to the
TitleBlock Tag Set in the DGN file TitleBlock.dgn.
Open the DGN file TitleBlock.dgn, then press the button MicroStation Title Block Updater, a VBA macro runs that pops the MicroStation Connector form.
Next, press the Update Title Block button to read the named cell data and update the DGN tags.
If you are using Visual Basic for Applications, open the References dialog from the Tools menu. Browse the list of Automation servers to find the LA Solutions Data Connector for MicroStation, check the box, and click OK to finish …
The MicroStation Data Connector is available for evaluation free of charge with no warranty of fitness for purpose
and is not supported.
The MicroStationDataConnector ZIP archive contains the MicroStationDataConnector.DLL,
a sample VB project with source code, and a sample Excel spreadsheet that includes a VBA project with source code.
The source code of the MicroStationDataConnector.DLL is not published.
Unpack the MicroStationDataConnector ZIP archive
to a folder of your choice. Run the setup.exe installer with a double-click.
Files are copied to
sub-directories of folder C:\Program Files\LA Solutions\MicroStation Data Connector.
The COM Automation servers are registered automatically during installation.
Return to MDL articles index.
FlexiTable provides a way to work with MicroStation and Excel. FlexiTable is a MicroStation plug-in that provide Excel compatibility. FlexiTable reads and writes Excel files.
FlexiTable can acquire MicroStation tag data in a worksheet that you can save as an Excel workbook. It can update tags in a MicroStation file from Excel data.
FlexiTable's title block capability lets you update drawing data in one or multiple DGN models.