Monday, January 18, 2016

Simplest method to export geometry from Civil 3D and import to HEC-RAS

The Civil 3D Output ribbon provides an Export to HEC-RAS button, and HEC-RAS provides an Import Geometry Data tool.  But getting river direction, river stations, banks, and cross section stations transferred right is not as easy or as obvious as it could be.  This is a method to export as completely as possible from Civil 3D and use as few fixes as possible in HEC-RAS to fix the data.
2016-08-19 Update.  It turns out my method was not quite working if you want to import banks or have everything display correctly in the Geometry Data map.  I have changed to a slightly different method that I think is more harmonious with the way Autodesk intended it to work.

Starting at 5:05, the video below is a good illustration of reversing cross sections as in steps 8 and 11 below.  And the entire video, though not produced for this post, is very closely related to this post.

Note: These were written toward Civil 3D 2016 and HEC-RAS 5.  But the general idea works with earlier Civil 3D and HEC-RAS 4.
  1. Civil 3D Surface. Start with a ground surface that completely encompasses both the river alignment and the cross sections.
  2. Stream alignment running downstream. Draw a stream alignment polyline (direction is not important).  Create a Civil 3D alignment from the polyline, and use the Reverse Alignment Direction tool if necessary so that the stations increase going downstream.  Having it point downstream is important so that the cross sections and banks read correctly from left to right looking downstream.  We will address the downstream to upstream hydraulic calculations later.
  3. Draw cross section polylines.  They should cross (not end at or short of) the centerline.
  4. Create a section sample lines group.  After you select the alignment, a toolbox appears where you can choose to create the sample lines from polylines. The finished sample lines should all start on the left and run to the right.
  5. Create bank polylines or feature lines.  Civil 3D will augment the cross sections wherever the banks cross the sample lines so that it can put the banks exactly there.
  6. Export to HEC-RAS.  Use the Ribbon, Output, Export, Export to HEC-RAS tool (ExportHecRas or _AeccHecRASExport command) to save your stream geometry as Civil-3D-geometry-export or some other helpful name.  Choose the banks as if looking downstream.
  7. In the HEC-RAS Geometry Data editor, use File, Import Geometry Data..., GIS Format... to import the Civil-3D-geometry-export you created.  When you get to the Cross Sections and IB Nodes, STOP.
  8. Rename cross sections to increase going upstream.  If you want, use the tools in the Cross Sections and IB Nodes tab to assign river stations to the sections, but DO NOT import yet. They will increase from upstream to downstream, which will make HEC-RAS calculate your stream backwards.  You may want to copy the stations to a LibreOffice (Go, Free/Libre Open Source Software!) spreadsheet, and subtract each River Station from the highest River Station.
    Use spreadsheet to fix cross section River Stations
    Then paste the resulting list (no reversing needed) back into the Cross Sections and IB Nodes, Import As column.
  9. Import.  Now you can finish the import. 
  10. Check XS directions.  In the Geometric Data, View, View Options, Cross Section Properties area, turn on the XS Direction Arrows check box. Verify that your cross sections run left to right (looking downstream) and your banks are in the right places.
    This stream has its narrower bank on the left, imported correctly. XS arrows point from left to right.
  11. Move reach lengths.  In the HEC-RAS Geometry Data editor, use Tables, Reach Lengths to cut and paste the lengths upward one section so that the zero length is at the bottom.
    Move reach lengths upward one section so bottom XS has zero lengths.
  12. Reverse stream arrow if pointing upstream.  In the Geometric Data editor, use the GIS Tools, Reach Invert Lines Table.., Reverse Order button to change the direction of the river to point downstream if it is pointing upstream (which is the case as of the versions of Civil 3D I have).
  13.  Verify that your profile looks right and runs upward to the right.
    Profile runs upward to the right
    Please comment below if you have any questions or suggestions/updates.
And finally a conscientious plea: Go hug and thank a family member and then move your money from a bank to a credit union.


    Anonymous said...

    Thanks for the walkthrough. One thing you need to be aware of: if you have skewed or dog-leg cross sections, the surface line data in RAS won't track with the "cut line"- the surface will be for a straight cross section, exactly perpendicular to the stream centerline, while the cut line will be where you want it to be.

    Maybe the bug has been fixed since c3D 2014? Here is an Autodesk forum post where I commented on the bug in 2010, and again in 2014:

    Thomas Gail Haws said...

    Thanks much for the tip!

    Sämi said...

    One of the most easy way to change the names of the stations when exporting from cad to hecras is:
    1. open the exported xxx.geo with the text-editor
    2. ctrl+h for replacing
    3. replace all text "STATION: " with "STATION: -"
    4. save
    5. import into hecras

    when you do this you give the station negativ values and so the highest value gets the lowest ;-)

    station 10, 20, 30 (flow direction in hecras = <--)
    station -10, -20. -30 (flow direction in hecras = -->)

    Sämi said...
    This comment has been removed by a blog administrator.
    Thomas Gail Haws said...

    Great tip! Thanks. I love it.

    Unknown said...

    Very helpful, but one thing I noticed; you should reverse the order of the downstream reach lengths in the same way you reversed the river stations otherwise just moving them up one row doesn't accurately represent the downstream lengths unless all your cross sections are spaced the same distance.

    Thomas Gail Haws said...

    Your concerned occurred to me too for a while, but it's mistaken, and it's not easy to explain why (probably because I have not thought it out rigorously myself, or I have forgotten). Let me know if this sounds rigorously correct.

    1. Civil 3D exports each cross section with geometry, a river station, and reach lengths. The station is totally wrong (backwards), but the reach lengths are right, except that they look upstream instead of downstream (so the upstream section has length 0). You can verify this by inspecting the output file.

    2. When we change the river stations, we are not reversing them. Rather we are subtracting them respectively from the river length (maximum river station). They still now have the right reach lengths, except that they are looking upstream.

    3. When our import is finished, HEC-RAS reverses the order of the cross sections using the corrected river stations we gave it. But the reach lengths are still right except that they are looking upstream. In other words, we need to move each length to the section above so it applies downstream.

    You can verify this this by making a river with short reaches at one end and long reaches at the other.

    Unknown said...


    Every time I try to import the data from civil 3D to Hec Ras my cross sections are not located on my reach. They are put over the the side in a small cluster. I'm not sure how to fix this issue. I've tried watching your videos and others multiple times and I have not found something to fix the problem. Any help is greatly appreciated.

    Thank you!

    Thomas Gail Haws said...

    Tia, send me your Civil 3D file.

    Unknown said...


    My cross sections aren't showing up when I import to Hec Ras. My river alignment shows up, but nothing else. What could be the issue?

    Thank you in advance!

    Thomas Gail Haws said...

    1. Do all cross sections cross the alignment?
    2. Do all cross sections fit inside the terrain?
    3. Do all cross sections start and end within the alignment? (Alignment doesn't need to be longer?

    Hülya said...

    When I export cross-sections from CIVIL-3D to HEC-RAS (I am studying an unsteady 1D flow simulation in HEC-RAS) and change the number of the stations as HEC-RAS want (the biggest cross-section number in the most upstream cross-section), the elevations become weird in each cross-section in HEC-RAS. The elevations in the cross-sections are around 3000 meters but they must be around 900 meters. This problem doesn't occur when I don't change the number of the cross-sections as HEC-RAS want. How can I solve this problem?
    Thanks in advance.

    Thomas Gail Haws said...

    Are you saying that the ground elevations are changing or that the water surface elevations are weird?

    Is it possible HEC-RAS or Civil 3D is somehow converting from meters to feet?