This article describes how to use a MicroStation Report to export DGN text element coordinates. It provides a useful alternative to MicroStation's XYZ Text tool. We explain the method used to define a custom Report.
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.
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. However, that tool is broken in MicroStation (at least to MicroStation CONNECT Update 10) and does not work correctly with text elements.
In a few simple steps, we'll define a MicroStation Report that will write a CSV or Excel file. The file will contain multiple lines of data. Each line will contain the text contained in a DGN text element and its XYZ coordinates.
In this example, we want to export text coordinates. The Report category is named XYZ Text. The Report definition is named Text2D …
This is where the user interface is confusing. We want to report information about text 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.
First, place at least one text element in your active DGN model (you'll read why in a moment).
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 Text. I write 'may contain' because that option won't show if there are no text elements in your DGN model! Click Text to add those to your Report …
Right-click the Report definition and choose Add Columns. Here we're adding a column named Text String that reports the content of the DGN text element, and another column named Origin …
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 OriginX, OriginY and OriginZ …
Now, right-click each Origin column in turn and choose Add Formatting. In the Coordinate Format pane, choose Select Coordinates …
For each XYZ column, click to open the option list of coordinate types and choose X, Y or Z as appropriate …
Your Text XYZ Report is ready! Click the Preview Results button …
Unlike the XYZ Text tool, your Report definition is adaptable. For example, you can add a Level column to the Report …
Send your Text XYZ Report to a CSV file …
Text String,OriginX,OriginY,OriginZ,Level Text 1,-8.941m,7.287m,0.000m,Text Text 2,-9.296m,5.911m,0.000m,Text Text 3,-9.296m,4.424m,0.000m,Text Text 4,-4.617m,7.132m,0.000m,Text Text 5,-5.083m,5.734m,0.000m,Text Text 6,-5.083m,4.358m,0.000m,Text 2 Text 7,-1.735m,7.265m,0.000m,Text 2 Text 8,-1.735m,5.756m,0.000m,Text 3 Text 9,-1.956m,4.491m,0.000m,Text 3
…or to an Excel file …
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.
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 …
Text String,Origin X,Origin Y,Origin Z,Level Text 1,-8.94,7.29,0.00,Text Text 2,-9.30,5.91,0.00,Text Text 3,-9.30,4.42,0.00,Text Text 4,-4.62,7.13,0.00,Text Text 5,-5.08,5.73,0.00,Text Text 6,-5.08,4.36,0.00,Text 2 Text 7,-1.73,7.26,0.00,Text 2 Text 8,-1.73,5.76,0.00,Text 3 Text 9,-1.96,4.49,0.00,Text 3
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.
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.
Post questions about MicroStation tools to the MicroStation Forum.