Importing an AutoCAD or MicroStation CAD file using ModelBuilder

Product(s): WaterCAD, WaterGEMS, HAMMER, StormCAD, SewerCAD, SewerGEMS, CivilStorm, PondPack
Version(s): CONNECT Edition, V8i
Area: Layout and Data Input

Overview

This TechNote provides tips and techniques for effectively importing a CAD drawing into a new or existing drawing using ModelBuilder. This procedure is similar for for any of the OpenFlows products. For general information on using ModelBuilder, see this following link: Using ModelBuilder to import external data.

Note: As of Update 4 (version 10.04.00.106)  .dgn, .idgndb, and .imodel  are no longer supported file types.  DGN files must now be exported to DXF format to be imported with ModelBuilder.  IDGNDB and IMODEL files are no longer eligible to be imported using ModelBuilder.  If you have questions, please contact Technical Support (Forum Service Request).

Also Note: If you need to import ESRI Shapefiles, the process is similar to the instructions below. The main differences is that you 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 is available 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 addition, the ModelBuilder link above uses a shapefile as an example.

Note: If you are importing a DGN file from OpenRoads Designer into one of the storm-sewer products (SewerGEMS, StormCAD, CivilStorm, or SewerCAD), you will be able to open this file directly by going to File > Open and changing the file type to DGN. The DGN file will open, with the hydraulics and hydrology elements imported in automatically.

Video Demonstration

See embedded video at the bottom of this article.

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. Also, use the "Units" command in AutoCAD to confirm the insertion scale units - you might assume they are feet for example but they may actually be inches.

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

Prior to the release of the CONNECT Edition version (10.XX.XX.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, but should look similar in CONNECT Edition. 

Important Assumptions:

  • Geometry (coordinates of the endpoints/vertices) is imbedded inside the drawing file and ModelBuilder will be able to import this automatically. Additionally if you choose the option to do so, nodes will automatically be created and pipes will automatically be connected to the endpoints based on spatial proximity.
  • Elevations are not automatically imported as they are not part of the core geometry that ModelBuilder can use. For example, junction ground elevation will need to be imported afterwards using Terrain Extractor. Or for storm-sewer applications, pipe inverts and node ground/invert elevations will need to be included as attributes and mapped explicitly to the respective model file using the Field Mapping step.
  • Similarly if pipe diameter is not included as an attribute of your polylines, you will need to separate the different diameters into different layers/levels.
  • Imported pipe lengths will be based on the polyline lengths using the "Coordinate Unit" that you select. Be sure to confirm the correct length units first before importing (use the "Units" command in AutoCAD for example).

ModelBuilder import steps:

Note: These steps assume you have different diameters in different layers/levels.

1.  Open the OpenFlows product 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. The layer name will be imported into this field so that diameters can be assigned 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 connection.

4.  In the first step, select "CAD Files" as the Data Source type and browse to your .DXF 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, only the layers that represent water distribution pipes of various diameters have been checked. 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, node 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. These elements will need to be added later on after the import.

5.   Click the 'Next' button to proceed to the second step. In this step, select the appropriate units (confirm the correct length units first before importing, using the "Units" command in AutoCAD for example). 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). The "Tolerance" field is used so ModelBuilder will automatically connect pipe end points to a node that is within the specified value. Make sure "Create nodes if none found at pipe endpoint" is checked as well. In most cases, only polylines are imported from a CAD drawing, so you will want junctions to be created at the ends of these. If this option is not checked, the polyline will not be imported, as an end node is required for pipe elements in the OpenFlows products.


Regarding the "Tolerance" options, take the following CAD line for example:


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


This is because the distance between the end points was not within the tolerance. If the tolerance is set to 2 feet, it would connect these end points and join them at a single junction:




6.   After clicking 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 the next step, accept the defaults of  "Current scenario" and "Label".

8.  In step 5, you must configure how the data in each layer is mapped to the OpenFlows product. 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, CivilStorm, and StormCAD).

"Key/Label"

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. ModelBuilder will then 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.

"Start"/"Stop"

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. Simply leave these as "<none>".

"Attribute"

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 above. In this example, the User Data Extension was named "AutoCADLayer":

By linking this field, there will be an attribute in the model that contains the name of the layer that the pipe came from. This will be useful later.

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.
  • As mentioned further above, elevations are not automatically imported as they are not part of the core geometry that ModelBuilder can use. Node ground elevation will need to be imported afterwards using Terrain Extractor. For storm-sewer products, pipe inverts and node ground/invert elevations will need to be included as attributes and mapped explicitly to the respective model file using the Field Mapping step.

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 your 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. This example case starts 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.)

Note: After filtering, 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.

Troubleshooting

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.

Video Demonstration

See Also

Using ModelBuilder to import external data

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

Polylines show as Polygon in ModelBuilder

Recommended
Related