Thursday, August 28, 2008

HEC-RAS Report

If you haven't heard, Autodesk released a revised HEC-RAS tool to import and export data between Civil 3D and HEC-RAS. It is available to download from the subscription site.

It appears that some of the code doesn't work correctly if you have free curve in the alignment and then reverse the alignment. The error message that is recieved is the one below (run-time error Invalid input.).

I'm not sure if the error is in the report or in Civil 3D. It appears that the entity count of the alignment returns a larger value than what is in the alignment. In my case I had three entities, but it returned that I had six. So when it ran looking for six, Civil 3D indicates that it isn't there and you get the error message. To fix it press the debug button and replace the code in the Public Function GetStreamCoords to End Function with the code below. This code uses a different method to get the PVI stations, the one from the original HEC-RAS report that shipped with the program. You may want to make a backup copy of the report in case it doesn't work.

' Get the stream alignment coordinates

' Fills up the stream network end points section

Public Function GetStreamCoords(ByRef ReachCoords() As Double, calign As AeccAlignment, csurf As AeccSurface)

Dim PLSta As Double

Dim PLOffset As Double

'Station & Offset of Pline Beg. Pt.

Set ReachEnts = calign.Entities

ReDim ReachCoords(0 To (ReachEnts.count * 4 + 3))

Dim oStation As AeccAlignmentStation

Dim q As Integer

q = 0

For Each oStation In calign.GetStations(aeccGeometryPoint, 0#, 0#)

ReachCoords(q) = Round(oStation.Easting, 2)

ReachCoords(q + 1) = Round(oStation.Northing, 2)

ReachCoords(q + 2) = Round(csurf.FindElevationAtXY(ReachCoords(q), ReachCoords(q + 1)), 2)

ReachCoords(q + 3) = Round(oStation.Station, 2)

q = q + 4


End Function


Anonymous said...

Thanks for posting this. I took a look and, using a free curve with reverse alignment applied, I cannot reproduce the issue. Any chance I could get a hold of the data set?

Karen Dowling
Autodesk Civil Test Development

Unknown said...


Thanks for posting this code fix. When I try to run it I get a compile error. "Method or data member not found"

Set ReachEnts = calign.EntitiesRe

Any ideas? Im not too familiar with VB.

Many thanks

Christopher Fugitt said...

Sorry about that, the line of code should be

Set ReachEnts = calign.Entities
and the following line
ReDim ReachCoords(0 To (ReachEnts.count * 4 + 3))


Blog Widget by LinkWithin