Introduction

This article describes how to use a MicroStation CONNECT Report to export DGN cell element coordinates and other information. It provides a useful alternative to MicroStation's XYZ Text tool. It's an explanation of the method used to define a custom Report.

Reports

Reports Icon

MicroStation CONNECT introduced Reports. Reports is an analytic tool. It extracts alphanumeric data (DGN or business data) from your DGN file, model, elements or elsewhere. When Item Types are in use, Reports can extract Item instance data attached to your DGN model or elements.

Visit our reports page for more information, and to see other examples of Reports in action. Don't forget to visit MicroStation's Reports help documentation.

Post questions about Reports to the Be Communities MicroStation Forum.

XYZ Text Tool

For some time, MicroStation has had an XYZ Text tool. That tool's purpose is to let you create a CSV file containing a list of coordinates. The tool is restricted to text and point (cell) elements.

Define a Cell Report

In a few simple steps, we'll define a MicroStation CONNECT Report that will write a CSV or Excel file. The file will contain multiple lines of data. Each line will contain the cell instance name, other cell information and its XYZ coordinates. Although this example reports normal cell instances, you can modify it with little effort to report shared cell instances.

Create a New Report Definition

In this example, we want to export text coordinates. The Report category is named Cells. The Report definition is named XYZ Cells …

Cell Report Definition 1

Add Cell Elements

This is where the user interface is confusing. We want to report information about cell elements, which are a type of DGN element. The Report definition form is asking for a Search Location and Included Items. Leaving Search Location as it is (collect information from the active model in the active file), focus on Included Items.

From MicroStation CONNECT Update 15, the Included Items pane has an Options option button that lets you choose Include All Classes or Include Used Classes.

Included Items

If using a version of MicroStation earlier than Update 15, that option does not appear. You must place at least one instance of a cell in the active DGN model to continue defining your report.

The form seems to be asking you for an Item Type. If you click that option, you are taken to a new anonymous form having an option button Include these Item Types. Don't give up! Click that button to find that you can also choose DGN Elements. Expand that option to see a list that may contain Cell. I write 'may contain' because that option won't show if there are no cell elements in your DGN model! Click Cells to add those to your Report …

Report Definition: Add Cell Elements

Add Columns to the Report

Right-click the Report definition and choose Add Columns. Here we're adding a column named Cell Name that reports the name of the DGN cell element, other information specific to cells, and another column named Origin …

Cell Report Definition 2

Format the Origin Column(s)

MicroStation formats the Origin column by merging its X, Y and Z values into one string. That may be inconvenient if you want to analyse individual coordinate values in some external application, such as Excel. We're going to apply formatting to the Origin coordinates to separate the X, Y and Z components. First, copy the Origin twice. Then, rename each column to Origin X, Origin Y and Origin Z …

Cell Report Definition 3

Now, right-click each Origin column in turn and choose Add Formatting. In the Coordinate Format pane, choose Select Coordinates …

Cell Report Definition 4

For each XYZ column, click to open the option list of coordinate types and choose X, Y or Z as appropriate …

Cell Report Definition 5

Your Cell XYZ Report is ready! Click the Preview Results button …

Cell Report Definition 6

More Columns

Unlike MicroStation's XYZ Text tool, your Report definition is adaptable. As shown above, you can add a Cell Type column (i.e. normal or shared) to the Report, or whether the cell is an annotation cell …

Cell Report Definition 7

Export Formats

Send your Cell XYZ Report to a CSV file …

Cell Name,Origin X,Origin Y,Origin Z
AreaLabel1,-8.159m,7.300m,0.000m
AreaLabel1,-8.159m,5.273m,0.000m
AreaLabel1,-8.159m,3.194m,0.000m
AreaLabel2,-5.480m,3.194m,0.000m
AreaLabel2,-5.480m,5.273m,0.000m
AreaLabel2,-5.480m,7.248m,0.000m

 …or to an Excel file …

Cell Report Definition 8

Additional Formatting

Krister Surell, an enthusiastic contributor to Be Communities, commented: there are tweaks you may like to make to your export presentation. When defining your Report, click on a coordinate column to see a Format pane on the right.

Cell Report Definition 9

As shown in the CSV report above, the coordinate data is written by default using MicroStation's master units label as the suffix (in this example, m for meters). The decimal precision is the default three decimal places. You can write an undecorated value by choosing Label Format MU instead of Use Active Settings. You can adjust the number of decimal places using the Accuracy option.

Here's the CSV result when we omit the units label and reduce decimal precision to two …

Cell Name,Origin X,Origin Y,Origin Z
AreaLabel1,-8.16,7.30,0.00
AreaLabel1,-8.16,5.27,0.00
AreaLabel1,-8.16,3.19,0.00
AreaLabel2,-5.48,3.19,0.00
AreaLabel2,-5.48,5.27,0.00
AreaLabel2,-5.48,7.25,0.00

Example DGNLib

Design Library file ReportExamples.dgnLib contains the Report definition described here. It is available, along with a sample CSV file and Excel file. More information here.

Contributors

I am indebted to Bentley Systems staff member David Trejo-Rodriguez who posted the original hint on which this article is based, and also to Krister Surell, an independent developer at surell consulting ab. They both contribute regularly to the MicroStation Forum.

Questions

Post questions about MicroStation tools to the MicroStation Forum.