Hi Chris,
I am trying to use the Output_NodeOutput subroutine twice within the same sub. I have two different plans that I would like to read from. When I call the Output_NodeOutput to read from the second plan, it is not reading it but still looking at the first one. I did call the second plan prior to the Output_NodeOutput sub using RC.Plan_SetCurrent.
here’s an abridged version of the code:
Sub PeakTimeWet()
Dim RC As New HECRASController
‘open a HECRAS project
Dim strRASProject As String
Worksheets(“Input”).Activate
Range(“C2”).Select
strRASProject = ActiveCell.Value
RC.Project_Open strRASProject
RC.ShowRas
Dim strBreachPlan As String
Dim strWetWeatherPlan As String
Range(“C3”).Select
strWetWeatherPlan = ActiveCell.Value
Range(“C7”).Select
strBreachPlan = ActiveCell.Value
RC.Plan_SetCurrent strWetWeatherPlan
‘determine the number of rivers and reaches
Dim lngNumRiver As Long
Dim lngNumReach As Long
Dim strRiver() As String
Dim strReach() As String
Dim lngRiverID As Long ‘River ID
Dim lngReachID As Long ‘Reach ID
RC.Geometry_GetRivers lngNumRiver, strRiver()
Range(“C4”).Select
lngRiverID = ActiveCell.Value
RC.Geometry_GetReaches lngRiverID, lngNumReach, strReach()
Range(“C5”).Select
lngReachID = ActiveCell.Value
‘Determine the number of cross sections
Dim lngNumRS As Long ‘Number of river stations
Dim strRS() As String ‘Name of river stations
Dim strNodeType() As String ‘Node types
RC.Geometry_GetNodes lngRiverID, lngReachID, lngNumRS, strRS(), strNodeType()
‘Peak stage from wet weather run
Dim sngWetStage() As Single: ReDim sngWetStage(1 To lngNumRS)
For k = 1 To lngNumRS
If strNodeType(k) <> “IS” Then
sngWetStage(k) = RC.Output_NodeOutput(lngRiverID, lngReachID, k, 0, 1, 2)
End If
Next k
‘Loads array with breach flow data
Dim sngBreachStage() As Single: ReDim sngBreachStage(1 To lngNumRS)
RC.Plan_SetCurrent strBreachPlan
For k = 1 To lngNumRS
If strNodeType(k) <> “IS” Then
sngBreachStage(k) = RC.Output_NodeOutput(lngRiverID, lngReachID, k, 0, 1, 2)
End If
Next k
End Sub
Any thoughts?
Thanks,
Christine