MicroStation Text Styles in FME

Pierre  Koelich
Pierre Koelich
  • Updated

Introduction

Text styles are named sets of text attributes, such as font, width, height, and color, that allow you to place text consistently and automatically within a DGN model. Text styles within Bentley MicroStation can be set through several different methods in FME, and a template file can be utilized to define the text style in MicroStation. The attached workspace is an example of setting MicroStation text styles in an Esri Shapefile to MicroStation DGN V8 translation.

Source Data

The source Shapefile datasets contain

  • Vancouver street segments with street names and street use types (residential, arterial, etc.) stored as attributes and
  • Vancouver park polygons with park names stored as attributes.

This is the source data displayed with the FME Data Inspector:

Step-by-Step Instructions

1. Read Source Shapefile Datasets

Start FME Workbench. On the Start Page, select New Workspace to create a blank canvas. Add a reader to the workspace (from the Readers menu, select Add Reader). Set the Format to Esri Shapefile and the Dataset to read VancouverStreets_small.shp.

Add a second Esri Shapefile Reader to the workspace, and the Dataset to read ParkPolygons_small.shp

2. Write VancouverStreets into DGN

Add a Bentley MicroStation Design (V8) writer to the canvas. Choose a location for the output data. 

Connect the streets feature type to this DGN writer. The street segments are written into the destination DGN with no styling. They are part of the base map. This task is not related to text styling.

To achieve the same style as this example, you can download the Seed file that we used from the downloads section. In the DGN writer parameters, click the ellipsis next to Seed File (V8 Only) and locate the downloaded Seed file.

The source dataset has too many street segments to label them all. To avoid multiple overlapping labels for the same street and labels with wrong rotation:

Street segments are:

    • generalized (vertices that are not needed are removed) with Generalizer
    • chopped into two vertices long segments with Chopper

Using LengthCalculator, Sorter, and DuplicateRemover, only the longest segment for each street is kept. Segments longer than 300m are also kept.

3. Remove Unnecessary Vertices

Add a Generalizer transformer to the canvas and connect it to the VancouverStreets_small reader feature type. In the parameters, set the Generalization Tolerance to 1; this value is driven by the coordinate system of the features passing through the transformer. 

4. Break Features in Points

Add a Chopper transformer to the canvas and connect it to the Generalizer. In the parameters, set the Maximum Vertices to 2.

5. Calculate the Length

Add a LengthCalculator transformer to the canvas and connect it to the chopped output port of the Chopper. Only the longest segment for each street will be used. We can use the LengthCalculator to determine this. Set the Length Dimension parameter to 2 (meaning 2D). The multiplier is set to 1 and will read the ground units; this number can be changed to scale the length to something different. 

6. Sort Attributes

Add a Sorter transformer to the canvas and connect it to the LengthCalculator. This will sort the features by a selected attribute. In this case, we will set the attribute to _length as length has a unit, we will use the Numeric option, and the order will be Descending. We will also have two more attributes to sort by: use and name, which will be sorted alphabetically and in ascending order. 

7. Remove Duplicates

Add a DuplicateFilter to the canvas and connect it to the Sorter. This will divide the features based on selected attributes by name and use. In the parameters, set the Key Attributes to name and use.

8. Filter Features by Length

You can run the workspace up to this transformer, and it will show that many features pass through the duplicate port. To account for all the duplicates, add a Tester to test these duplicated features based on their length. We want to include features greater than 300. 

 

9. Label Streets

Add a Labeller to the canvas and connect it to both the DuplicateFilter Unique output port and the Tester Passed output port. Edit the following parameters to match the style in this article. 

  • Label: name
  • Label Offset: 0
  • Label Height: 28
  • Label Spacing: 1000
  • Labels at End Points: No

The style you desire may require some experimentation. 

10. Filter by Road Type

Add a TestFilter to the canvas and connect it to the Labeller. This TestFilter aims to filter the type or use of each road in the dataset, in this case, ARTERIAL, COLLECTOR, and RESIDENTIAL. Set the following test conditions.

  Test Condition Output Port
If

@Value(use)=Secondary Arterial OR

@Value(use)=Arterial

ARTERIAL
Else If  @Value(use)=Collector COLLECTOR
Else If @Value(use)=Residential RESIDENTIAL
Else <All Other Conditions> <UNFILTERED> 



Text Styles in a DNG File

We will look at three different methods of setting text styles in a DGN file. 

Method 1: Add an AttributeCreator to the canvas and connect it to the ARTERIAL output port on the TestFilter. We need to specify the attributes used to create text in MicroStation.

New Attribute Attribute Value
igds_text_size 48
igds_font 1027
igds_justification 7
igds_color 3

Method 2: The DGNStyler provides a convenient interface to set various Bentley MicroStation Design format-specific attributes. Add a DGNStyler and connect it to the COLLECTOR output port on the TestFilter; text style attributes will be set using the DGNStyler. Set the following attributes.

  • Color
  • Color By Level: No
  • Color Type: Index
  • Index Number: 6 
  • Text
    • Font Number: 1027
    • Text Size: 38

Method 3: This method uses another DGNStyler but is different from Method 2 we will assign the Text Style ID. Add another DGNStyler to the canvas and connect it to the RESIDENTIAL output port on the TestFilter. In the DGNStyler_2 parameters, set the following parameters

  • Text Style ID: 3

11. Write out Street Names to DGN

Right-click on the canvas and choose Insert Writer Feature Type. In the parameters, set the Level Name to StreetNames. Connect the AttributeCreator, DGNStyler_COLLECTOR, and DGNStyler_RESIDENTAL to the Writer Feature Type.

12. Style DGN Park Polygons

Add a DGNStyler to the canvas and connect it to the ParkPolygons_small reader feature type. 


Open the DGNStyler parameters. Enable Color, then set Color Type to Color Index, set the Index Number to 82, and the Fill Index Number to 2.



By setting the Color Type to Color Index, we must specify the color to use in the Index Number. The number used for Index and Fill Index is an assigned value between 0 and 255 in Microstation.
For more information on the DGNStyler, please see the documentation.
 

13. Add DGN Writer Feature Type

Next, add another DGN Writer (V8) Feature Type and connect the DGNStyled output port to the DGN writer. Specify the destination of the DGN file and ensure it has the same name (VancouverStreets) as the DGN file created in the DGN writer that we created in the previous step.

14. Create a Bounding Box Around Park Polygons

Add a CenterPointReplacer. This will replace a feature's geometry with a point that is either at the center of the feature's bounding box or at the center of mass of the feature. Connect the ParksPolygon_small reader feature type to this transformer. In the parameters,  select Center Point of Bounding Box for the Mode.


 

15. Change Case of the NAME Attribute

Add a StringCaseChanger and connect it to the CenterPointReplacer. This changes the case of text attributes to uppercase, lowercase, Title, or Full Title. Select NAME as the Attribute and choose Full Title Case as the Case Change.


 

16. Filter out Parks with No Name

We need to use a Tester transformer to filter out the parks without a name. Add a Tester to the canvas and connect it to the StringCaseChanger. Set the Logic to NOT. The Left Value will be the NAME attribute, and the Operator will be Attribute is Missing, meaning if there is no name, the attribute will exit through the failed port.


 

For park polygons, labels are created by replacing polygon center points with texts using a LabelPointReplacer transformer. Once again, text style can be set by a DGNStyler transformer’s Text Style ID parameter.
 

17. Add a Point to Attach Labels

Add a LabelPointReplacer, and connect the Passed port from the Tester to the LabelPointReplacer. This transformer will replace the geometry of the park polygons with a label point. 

Set the following in the Parameters window:

  • Label: NAME attribute
  • Label Height: 40
  • Always Rotate Label: No

18. Style DGN Text

Add a DGNStyler to the canvas and connect it to the LabelPointReplacer. The DGNStyler will require some experimentation to find the desired font. Open the Parameters and click the Color checkbox. Set the Color By level to No and the Color type to Color Index. Click the checkbox for Text and set the Text Style ID to 4.

19. Add a Writer Feature Type and Run Workspace

Add another writer feature type and name it ParkNames, then connect the output from the DGNStyler to it.

Run the entire workspace.

A completed version of this workspace with the name writingtextstylesDGN.fmwt is available with descriptive annotations and bookmarks.

How to find out igds_textstyle_id or igds_font values

To find out igds_textstyle_id and/or igds_font values:

  • Open your seed-file in MicroStation
  • Add text features using text styles and/or fonts you are interested in
  • View the seed-file in Data Inspector and check igds_textstyle_id and/or igds_font values
  • Delete the added text feature from the seed-file
  • Save the seed-file

It is recommended to do this using the seed-file rather than another file, as when a text style or a font is added to the seed-file, it gets ‘introduced’ to the seed-file (gets igds_textstyle_id or igds_font value assigned from the FME user point of view).

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.

Was this article helpful?

We're sorry to hear that.

Please tell us why.

As of January 14th, 2026, comments on knowledge base articles have been closed. To make sure questions don’t get missed and to enable more community support, we’ve moved discussions to the FME Community. If you have a question or a comment about this article, please create a new post or create a support ticket.