FME Version
Files
-
- 500 KB
- Download
Introduction
This article will show you how to convert an AutoCAD DWG (*.dwg) file to MicroStation DGN (*.dgn) in FME. In addition to a basic format-to-format translation, we will modify the schema and use the DGNStyler to style the output data.
Video
Note: this video was created with FME version 2016.0. Some of the steps might be slightly different, but the overall process is the same. The instructions below are for 2022.2.
Step-by-Step Instructions
In this scenario, we will use road data, which is divided into different layers for each road type, each of which has a different symbology. We will transform the symbology, convert the AutoCAD attributes to MicroStation tags, and merge a few layers before writing to DGN.
Download this article's attachments, including the source data and finished workspace, to follow along.
1. Create a blank workspace in FME Workbench
Open FME Workbench and start a blank workspace.
2. Add an AutoCAD reader
Click Add Reader and set the following parameters:
- Format: Autodesk AutoCAD DWG/DXF
- Dataset: <Path to tutorial download>/Roads.dwg
- Parameters: Group Entities By: Attribute Schema
Setting the parameter to group by attribute schema means we can visualize the layers with attribute information. Note how there are other parameters to control other aspects of reading the DWG data too.
Click OK to add the reader to the workspace.
The Select Feature Types dialog will appear. Leave all feature types checked to import all layers, and click OK.
You have successfully added a DWG reader for Roads.dwg to the workspace. The canvas should look as follows:
3. Add Bentley Microstation Design (V8) DGN writer
Click Add Writer, and set the following:
- Format: Bentley Microstation Design (V8) DGN
- Dataset: <Path to destination>/Roads
Click Parameters, and set the following:
- Write tags: Yes
- Seed File (V8 only): <Path to FME installation>/design/seed2d_ft_v8.dgn
The "Write tags" parameter tells FME to write tags for the features. The "Seed File" parameter specifies a 2D output instead of 3D. Seed files are located in your FME installation folder. For example, *\FME 2022.2\design\seed2d_ft_v8.dgn on Windows or /Library/FME/2022.2/design/seed2d_ft_v8.dgn on Mac.
Click OK on the Parameters dialog and OK again to add the writer to the workspace.
The Select Feature Type dialog will appear. Select all feature types and click OK.
You have successfully added a DGN writer to the workspace. The canvas should look as follows:
4. Modify the output schema, i.e. perform schema mapping
The workspace currently creates an exact copy of the source data. We would like to modify the layers in the output file before running it.
(a) Drag the connections from the input feature types "NonCity", "Other", and "Private" to the output layer "Other".
(b) Connect the rest of the input feature types to their respective outputs.
(c) Delete the unused NonCity and Private output feature types.
The workspace should look as follows:
5. Add a DGNStyler transformer
We will now style the output symbology. Add a DGNStyler and connect it before the Other output feature type. The workspace should look as follows:
Open the transformer's parameters and set the following:
-
Color:
- Check the box
- RGB Color: choose a color or set it to lilac by copy-pasting: 0.666667,0.666667,1
-
Lines:
- Check the box
- Line Weight: 3
- Line Style: 2
Click OK. You have successfully styled the output DGN symbology.
6. Run the workspace
Click Run Workspace. When the translation is complete, navigate to the output DGN dataset in your file system. You can inspect the output using the FME Data Inspector or a 3rd-party CAD viewer such as Bentley View.
Note how the line data in the DGN file has been written using the symbology specified in the DGNStyler, and the DWG attributes have been written as MicroStation tags. In the below Bentley View screenshot, you can see the Burrard Bridge in Vancouver has been styled under the Other writer feature type (dashed line) and has its attributes as tags.
Data Attribution
The data used here originates from data made available by the City of Vancouver, British Columbia. It contains information licensed under the Open Government License - Vancouver.
Comments
0 comments
Please sign in to leave a comment.