Introduction
This article will cover how to write MicroStation text nodes, using multi-line text and text elements as list attributes. Text node features are point features and only have a single coordinate. Normally, text nodes are used to group together lines of text into a single complex element. However, such text groups are handled by the igds_multi_text type and not by the igds_text_node type, which is used only for text nodes with no attached text.
The key to writing text nodes to MicroStation DGN is to define the text as a list attribute for each node. A list attribute in FME is a way to store multiple values for an attribute. Each value in the list becomes a line of text in the text node.
FME Format Attributes
Information is often stored in FME as format attributes. The format attributes for a text node are stored in a list called igds_text_elements{}, and the list features must be associated with igds_type of igds_multi_text. Setting the igds_type ensures FME knows that these features are text nodes. Here you can see the igds_text_elements{} in a DGN Writer feature type:
For example, to create a text node feature representing pipeline IDs a user could to define:
- igds_text_elements{0}.igds_text_string = Pipe173
- igds_text_elements{1}.igds_text_string = Pipe617
- igds_text_elements{2}.igds_text_string = Pipe941
- igds_text_elements{3}.igds_text_string = Pipe833
They could also define any other format attributes, such as the x/y location, or the text font.
Additionally, the user must inform FME that this is a text node by setting:
- igds_type = igds_multi_text
Step-by-Step Instructions
Part 1: Writing MicroStation Text Nodes - Basic Example
1. Start a New Workspace
Start FME Workbench. On the Start Page, select New Workspace to create a blank canvas.
Add an AttributeCreator transformer to your canvas to being your workspace.
Add a Creator transformer to the workspace.
The Creator transformer creates a feature to start a workspace using parameters supplied by the user. For more information on the Creator, please see the documentation.
Open the Creator Parameters and set the Geometry Object to Point. This will draw a point with coordinates 0,0.
Click ok to close the Creator Parameters. This will add one singular point that we can reference.
Add an AttributeCreator transformer to your canvas and connect it to your Creator.
As of FME 2025.2, many transformers have been updated to not require input from the creator transformer. For a list of all the transformers with this improvement, please see Transformers with an Optional Input Port
2. Configure the AttributeCreator
Double-click on the AttributeCreator transformer to open the parameters window. Add the following attributes and click OK.
| Output Attribute | Value |
|---|---|
| igds_text_size | 1.5 |
| igds_type | igds_multi_text |
| igds_node_number | 1 |
| igds_text_elements{0}.igds_text_string | Label 1 |
| igds_text_elements{1}.igds_text_string | Label 2 |
| igds_text_elements{2}.igds_text_string | Label 3 |
| igds_text_elements{0}.x | 10 |
| igds_text_elements{0}.y | 10 |
| igds_text_elements{1}.x | 10 |
| igds_text_elements{1}.y | 8 |
| igds_text_elements{2}.x | 10 |
| igds_text_elements{2}.y | 6 |
We are using these attributes to hard-code the text node content.
3. Add a DGN Writer
From the Writer menu, select Add Writer and set the following:
- Format: Bentley MicroStation Design (V8)
-
Dataset: nodes.dgn
- Click on the ellipses to navigate to a location on your computer
Click Ok to add the writer to the canvas when prompted, and set the Level name to Labels.
Run the workspace and view the results
Part 2: Writing MicroStation Text Nodes - Practical Example
The following example is more complex but is more realistic. It involves a source dataset of tree types. Each tree is listed under a specific postal address, and multiple trees may be associated with each address.
The idea is to create a text node for each address that lists all of the trees.
The Workspace (Writing DGN Text Nodes Practical Example) can be found in the Files section of this article. If you want to follow along and create the workflow yourself, please download PublicTrees.csv and Addresses.gdb as these will be needed in the next part
1. Add a CSV Reader
Start FME Workbench. On the Start Page, select New to create a blank canvas.
Add a Reader to the workspace and configure the following:
- Format: CSV (Comma Separated Value)
-
Dataset: PublicTrees.csv
- Click the ellipses to navigate to the location of the file on your computer
Click OK.
2. Add Esri Geodatabase Reader
Add another Reader to the workspace and set the following:
- Format: Esri Geodatabase (File Geodb Open API)
-
Dataset: Addresses.gdb
- Click the ellipses to navigate to the location of the file on your computer
Click OK.
When prompted, select the PostalAddress from the Select Feature Types dialog.
3. Add a FeatureMerger Transformer
Add a FeatureMerger to the canvas by typing “FeatureMerger” to bring up the list of FME Transformers in the Quick Add Search. Select the FeatureMerger from the list of transformers by double-clicking or by using the arrow keys and the Enter key to add it to the workspace.
Once the transformer has been added, connect the CSV reader to the Requester port and connect the PostalAddress to the Supplier port.
Open the FeatureMerger Parameters, click the drop-down under the Requestor heading, click attribute value and select the Address Attribute.
Repeat the same steps for the Supplier and select PSTLADDRESS from the attribute list.
In this step, we are choosing a common attribute to join these two data sources together.
On the Merge Parameters, set the Feature Merge Type to Attributes and Geometry
4. Add AttributeCopier Transformer
Add an AttributeCopier transformer to the canvas by typing “AttributeCopier” to bring up the list of FME Transformers in the Quick Add Search. Select the AttributeCopier from the list of Transformers by double-clicking or by using the arrow keys and the Enter key to add it to the workspace.
Once the transformer has been added, connect the Merged port from the FeatureMerger transformer to the AttributeCopier.
Open the AttributeCopier parameters, this will allow you to create a new attribute based on the original attributes that were read in.
Click the Input Attribute drop-down and select Species.
Click the Output Attribute box and type igds_text_string.
The igds_text_string is the attribute that the Microstation writer uses to create text on dgn.
5. Add a Counter Transformer
Add a Counter transformer to the canvas.
Once the transformer has been added, connect the Output port from the AttributeCopier transformer to the Counter transformer.
The Counter transformer adds a numeric attribute to a feature and assigns a value. Each subsequent feature passing through the transformer receives an incremented value.
Open the Counter Parameters. Set the Count Output Attribute to TreeNumber so for each species of tree that is at an address, the counter begins counting from 0 up.
Set the Counter Domain to the Address attribute from the drop-down, this will set the counter to read the Address each time.
6. Add CoordinateExtractor Transformer
Add a CoordinateExtractor to the canvas.
Once the transformer has been added, connect the Output port from the Counter transformer to the CoordinateExtractor transformer.
Open the CoordinateExtractor Parameters. The CoordinateExtractor is used to extract the x, y and z coordinates from the specified index into attributes. The default settings work in this case, we do not require a Z value.
7. Add an ExpressionEvaluator Transformer
Add an ExpressionEvaluator to the canvas.
The ExpressionEvaluator is used to calculate the x and y coordinates of each line in the text node.
The expression used in this case is: @Value(y)-(8*@Value(TreeNumber))
This expression is used to calculate the y-coordinate for each tree line at the specified address. The value 8 basically controls the spacing between each line.
8. Add an Aggregator Transformer
Add an Aggregator transformer to the canvas.
The Aggregator is used to combine feature geometries into heterogeneous or homogeneous aggregates. Alternatively, it combines feature attributes without any geometry. In this case, the features will be aggregated or combined by Address. Set the following Parameters
-
Group Processing: Enabled
- Group By: Address
-
General:
- Aggregation Mode: Geometry - Assemble One Level
-
Attribute Accumulation:
- Attribute Accumulation Mode: Use Attributes From One Feature
-
Generate List: Enabled
- List Name: igds_text_elements
-
Add To List: All Attributes
- By selecting this option, all the trees are aggregated into the same list by Address.
If a Count Attribute is entered, then an attribute with this name will be added to each output aggregate, containing the number of features that were combined to form the aggregate. Enter NumTrees in the Count Attribute field. This will create an attribute with this name for each output aggregate.
A limitation of the Aggregator is that it removes the geometry. To counteract this, we can add a VertexCreator transformer.
9. Add a Counter Transformer
Add a Counter transformer to the canvas. This will give each node a unique ID number, which will increase incrementally as each feature passes through the transformer.
Open the Counter parameters and set:
- Count: igds_node_number
10. Add AttributeManager Transformer
Add an AttributeManager transformer to the canvas. The AttributeManager will create two Microstation Attributes, igds_text_size and igds_type, which are used to create text.
Double-click on the AttributeManager and add the following attributes:
-
Output Attribute: igds_text_size
- Value: 5
-
Output Attribute: igds_type
- Value: igds_multi_text
Click OK.
11. Add a Microstation Reader to the Canvas
From the Writer menu, select Add Writer and set the following:
- Format: Bentley MicroStation Design (V8)
-
Dataset: nodes.dgn
- Click on the ellipses to navigate to a location on your computer
Click OK.
Run the workspace, then view the results in MicroStation.
The attached template workspace, writing-dgn-text-nodes-practical-example.fmwt, walks you through this workspace and includes descriptive annotations and bookmarks.
Usage Notes
- These examples are just two ways to create the required list. The second example is particularly useful when the number of labels for each text node is unknown. But any method of creating such a list will produce the correct results, and your scenarios may not need all of the transformers shown here (they may need more!).
- Note that all lists in FME start at element 0 (zero). They do not start at 1 (one).
- Features won't be visible in the FME Data Inspector unless they are given a color other than white. Use a DGNStyler transformer to do that.
- The FME Data Inspector does not render igds_multi_text features as they would be in MicroStation. To see the text, you need to use the Split Multi-Text writer parameter. To see the attribute structure, you need to uncheck the Split Multi Text parameter (in which case, FME will display the node number, but the multi-text attributes will be preserved)
Data Attribution
The data used here originates from open data made available by the City of Vancouver, British Columbia. It contains information licensed under the Open Government License - Vancouver.