Importing an AutoCAD or MicroStation CAD file using ModelBuilder

Product(s): WaterCAD, WaterGEMS, HAMMER, StormCAD, SewerCAD, SewerGEMS, CivilStorm
Version(s): 08.11.XX.XX and 10.00.00.XX
Area: Layout and Data Input


Some older versions of the Hydraulics and Hydrology product line (WaterCAD, WaterGEMS, StormCAD and SewerCAD) used a much different procedure for converting "polylines to pipes", compared to the 08.XX.XX.XX versions. This TechNote provides tips and techniques for effectively importing a CAD drawing into V8 XM, V8i, or CONNECT Edition using the new method. This procedure is similar for WaterCAD, WaterGEMS, HAMMER, StormCAD, SewerCAD, SewerGEMS, and CivilStorm.

NOTE: if you need to import ESRI Shapefiles, the process is similar to the below. The main differences is that you would need to select multiple shapefiles at the same time (hold down the CTRL or Shift key to multi-select) in the first Modelbuilder step, as you would have one set of shapefiles for each element type (polyline shapefile for pipes, point shapefile for junctions, point shapefile for pumps, etc). This will allow you to map each element type to each shapefile, in the table mapping step. Shapefiles also typically have more attributes exposed which can be mapped in the field mapping step. For example diameter as a field in a single pipe polyline shapefile, compared to a DXF that may have one layer for each diameter (and would need to be imported in passes with the use of prototypes as explained further below).


In older versions of WaterCAD, WaterGEMS, StormCAD and SewerCAD (circa 2006), the user would import a CAD drawing (.dxf or .dwg) via File > Import > Polyline to Pipe. Upon release of the V8 XM edition, this functionality was merged into ModelBuilder, which is a powerful tool used to import many different types of data. Since the steps in the ModelBuilder process are very similar for most data source types, there are some extra options involved for a CAD drawing, which could initially cause some confusion to new users of V8 XM, V8i, and CONNECT Edition.

Preparing the CAD Drawing

1.  First, you should take some time to clean up your CAD drawing prior to performing the conversion. Look for entities that should not be converted, such as leader lines, and move them to their own layer. Turn off or remove layers that you do not wish to convert. Ensure that linework is in Model Space (or in MicroStation, Model Type = Design) Do a quick review of your drawing and correct any potential conversion problems that you may find.

Note: It is recommended that you perform a "save-as" before cleaning up the drawing, so that you can retain the original.

2.   Next you will need to save your CAD drawing to one of the supported CAD file types listed in the next section of this article.

Supported CAD File Types

Starting in the CONNECT Edition version of the products (10.00.00.XX), ModelBuilder accepts the CAD formats .dxf, .dgn, .idgndb, and .imodel.

Prior to the release of the CONNECT Edition version (10.00.00.XX), the only CAD format accepted by ModelBuilder was the .dxf file type. DXF is the "drawing exchange format", so almost all CAD programs have the ability to save to it. Whenever possible, try to save to the earliest DXF format, for better compatibility. For example, in AutoCAD, go to File > Save As, and choose "2004 DXF" as the format.

Importing Your CAD Drawing Using ModelBuilder 

Note: This process remains the same whether you are in the standalone, AutoCAD, MicroStation, or ArcGIS platform. This process was developed from and the screenshots were taken from the V8i version of the products. It is assumed that certain pipe diameters are separated by layer. If you're using V8 XM or CONNECT Edition instead, the steps in the ModelBuilder process will look slightly different, but basic procedure remains the same.

1.  Open WaterCAD/GEMS and start a new project. Ensure that the correct unit system is specified. Go to Tools > User Data Extensions.

2.  Right click on "Pipe" and choose to create a new user data extension. We will import the layer name into this field so that we can assign diameters at a later point. Give it a name, keep the default data type of "Text" and click OK.

3.  Start ModelBuilder by going to Tools > ModelBuilder. In the main window, click the "New" button to start a new ModelBuilder run.

4.  In the first step, select "CAD Files" as the Data Source type and browse to your .dxf file. Alternatively in the CONNECT Edition of the products, you can select Bentley Drawing File and browse to a .dgn, .idgndb, or .imodel file. Once selected, a table will be displayed in the lower left corner, showing all the layers that exist in the drawing. Layers that you would like to be imported should be checked. Unchecked layers will not be imported. The layer type will be displayed after the name of each layer, showing you if the layer contains points, lines, or polygons. In this example, we have checked only the layers that represent water distribution pipes of various diameters. Layers containing roads, annotations, and other irrelevant items have been unchecked:

Note: If you have a lot of layers that need to be unchecked, you can right-click anywhere in the list and choose "clear selection".
Note: In many cases, nodal elements such as tanks, pumps, etc are represented in a CAD drawing as a series of lines. In this case, they cannot be imported as their respective nodes in the ModelBuilder process. The user must enter these elements later on after the import.

5.   Click the 'Next' button to proceed to the second step. In this step, you should select the appropriate unit and also make sure the check box next to "Establish connectivity using spatial data" is checked. This option allows ModelBuilder to use the spatial information inside the CAD file (lengths, coordinates of endpoints/bends, etc) to build the model, instead of the user needing to explicitly specify the start/stop node (which is typically not possible for a CAD drawing.)

In addition to this, the "Tolerance" field will allow ModelBuilder to automatically connect pipe end points that are within the specified value. Make sure "Create nodes if none found at pipe endpoint" is checked. In most cases, only polylines are imported from a CAD drawing, so you'll want junctions to be created at the ends of these.

      1. For the "Tolerance" options, take the following CAD line for example

      1. In this zoomed-in view, notice that a gap exists due to drawing imperfections. This gap is 1.5ft wide. Now, if we import this CAD file with 1 ft. set as the tolerance it will create two nodes at the actual end points of these pipes

      1. This is because the distance between the end points was not within the tolerance. If we were to instead import this drawing with a 2ft tolerance, it would connect these end points and join them at a junction:

6.   Next, you will only need to keep the "Add objects to destination if present in source" box checked, since we are creating new elements based on the CAD drawing data.

7.  In step 4, accept the defaults of  "Current scenario" and "Label".

8.  In step 5, you must configure how the data in each layer is mapped to WaterCAD/GEMS. Click each layer from the list on the left and then configure the attributes on the right:

"Table Type"

This is used to select the type of element that a layer will be imported as. For a CAD file, you will most likely be importing polylines only. So, this field will be set to "Pipe" (for WaterCAD, WaterGEMS and HAMMER) or "Conduit" (for SewerCAD, SewerGEMS and CivilStorm).


This is the field used to create labels for the elements created by the ModelBuilder process. It is also used to link up elements when updating existing ones. In the case of importing a CAD drawing, most likely a field containing unique labels does not exist for the polylines. So, you should select "<label>" for each layer. This will cause ModelBuilder to automatically generate unique labels, utilizing a combination of an element's layer type label, its shape type, and a numeric ID that represents the order in which it was created.


Choosing the "Establish connectivity using spatial data" causes the connectivity information to be taken from the CAD drawing, so you do not need to specify a start/stop node field for the pipes/lines. So, simply leave these as "<none>".


At the bottom right corner of this ModelBuilder step, the user can link fields in the source data to fields in the program. In the case of a CAD drawing, typically there are no additional, useful attributes. However, you could link the "Layer" field to the user data extension attribute that you created in step 2. In this example, the user data extension was named "AutoCADLayer":

By linking this field, there will be an attribute in the WaterCAD/GEMS model that contains the name of the layer that the pipe came from. Later on this will be useful.

Note: Make sure that you set the key/label field and "layer" mapping for each layer. If your CAD file contains points, they will show up as separate layers on the left side. You can then click and assign them to a node element type such as Junction.

9.  In the last ModelBuilder step, choose to build the model. ModelBuilder will then import the layers and provide you with a summary, including a "Messages" tab that you can use to view informational messages about the import process. In this case, there are some messages about nodes being created due to missing start/stop nodes. This is expected since we were only importing polylines, with the "Create nodes if none found at endpoint" option selected.

10.   After closing the summary and closing ModelBuilder you will be prompted to synchronize the drawing. Choose "Yes" and your model should show up in the drawing area.  If it does not, then go to View > Zoom > Zoom Extents.

Note: Upon completion of your ModelBuilder run, it is suggested you use the Network Navigator tool to identify any connectivity or topological problems in your new model.

Assigning Pipe Diameters

Now that our model has been created, we can assign diameters to the pipes, based on the layer attribute that we imported.

1.   Open the pipe FlexTable via View > FlexTables.

2.   Click the yellow Edit button ( ) and add your user data extension. To do this, first find it in the list on the left side, click on it, and then click the single arrow button pointing to the right side. Click OK and you will now see a column in the FlexTable, containing the layer that each pipe came from. In our example case, the layer "12_WATER" represents 12" pipes, "16_WATER" represents 16" pipes, and so forth.

3.  Right click on any of the column headers, choose "Filter", and select "Custom". In the query window, double click on your user data extension field from the list on the left and click the equals sign button. Then, click the green button on the top-right corner to retrieve a list of unique values from this field. Double click on one of the diameters (layer names) shown. In our example case, we'll start with the 10" layer:

When you click OK in the query window, the FlexTable will be filtered to only show pipes that came from the layer that you queried on (those from the "10_WATER" layer in our example case.)

Note: After performing your filter, the bottom left corner of the FlexTable will show you how many pipes met the query condition and are displayed (for example "68 of 4714 elements displayed")

4.   Now, assign the correct diameter by right clicking on the "Diameter" column header and choosing "Global Edit". Keep the operation as "Set", and enter the appropriate diameter as the value. Click OK and your diameters will be assigned.

5.   Repeat steps 3 and 4 for each layer, assigning out all your diameters.

Note: When done, you can reset your filter by right clicking on any column header and then choosing Filter > Reset.

Note: An alternative way to assign diameters would be to bring each layer in one by one. Instead of using the user data extension, create a Prototype under View > Prototypes, and set the pipe diameter to the smallest one in your CAD Drawing. Next, uncheck all layers in the first ModelBuilder step except for the one corresponding to that diameter. Import the pipes per above and they'll be assigned the diameter specified in the prototype. Next, change the pipe prototype diameter to the next size, open the ModelBuilder run again, uncheck the first diameter and check the next one. Continue on like this for each diameter.


When importing a layer which contains only lines or polylines, ModelBuilder recognizes the layer as a polygon instead of polylines.

Make sure all polylines have a length. The layer may contain a point (line without length). Other applications such as MicroStation and AutoCAD may recognize the element as a polyline, but ModelBuilder does not since the endpoints are at the same location. Either delete these points or replace them with a line that has a length. This is also discussed in this article.

See Also

Building A Model Using ModelBuilder [TN]

Updating A Model Using Model Builder

Not all the layers in my DXF file are showing up in ModelBuilder

Polylines show as Polygon in ModelBuilder