You are on page 1of 1

Sub OutputExtractionExist()

Application.ScreenUpdating = False

'1. Iniciar variable de clase HECRASController


Dim RC As New RAS41.HECRASController

'2. Abrir HEC-RAS en segundo plano


Dim ProjectFileName As String
ProjectFileName = Worksheets("Inicio").cells(4, 2)
RC.Project_Open ProjectFileName

'3. Abrir HEC-RAS en primer plano


'RC.ShowRas

'3.5 Seleccionar Plan


Dim PlanCount As Long, PlanNames() As String, PlanID As Long
PlanID = 1
RC.Plan_Names PlanCount, PlanNames(), True

'Obtener valores de nRSNw(PlanID) de cada plan el de máximo de ellos


Dim nRSNw() As Long, MaxValRSNw As Long
MaxValRSNw = MaxRSValue(RC, PlanCount, PlanNames, nRSNw())

RC.Plan_SetCurrent PlanNames(PlanID)

'3.7 Obtener nombres de river, reach y profile


Dim nRiver As Long, River() As String, nReach As Long, Reach() As String
Dim riv As Long, rch As Long 'ID de river y reach
Dim nProfile As Long, Profilename() As String

RC.Output_GetRivers nRiver, River()


riv = RC.Output_GetRiver(River(1))
RC.Output_GetReaches riv, nReach, Reach()
rch = RC.Output_GetReach(riv, Reach(1))
RC.Output_GetProfiles nProfile, Profilename()

'4. Correr Modelo


Dim nMsg As Long 'Número de mensajes retornados
Dim Msg() As String 'Arreglo de caracteres de los mensajes retornados
RC.Compute_CurrentPlan nMsg, Msg

'5. Obtener número y tipo de nodos


Dim nRS As Long 'Número total de secciones transversales
Dim RS() As String 'Arreglo con los nombres de las secciones transversales
Dim NodeType() As String 'Tipo de nodo: "", "BR", "Culv", "IS", "LS"

RC.Geometry_GetNodes riv, rch, nRS, RS(), NodeType()

'6. Obtener resultados


'Arreglo de las variables de escurrimiento
Dim RSNw() As String, MinChEl() As String, QTotal() As String, AreaXS() As String,
WSElev() As String, _
MaxChlDpth() As String, TopWidth() As String, HydrRadius() As String, VelTotal() As
String, _
EGElev() As String, EGSlope() As String, FroudeXS() As String, NodeTypeNw()

ReDim RSNw(1 To nRSNw(PlanID)), MinChEl(1 To nRSNw(PlanID), 1 To nProfile), QTotal(1


To nRSNw(PlanID), 1 To nProfile), _
AreaXS(1 To nRSNw(PlanID), 1 To nProfile), WSElev(1 To nRSNw(PlanID), 1 To nProfile),
MaxChlDpth(1 To nRSNw(PlanID), 1 To nProfile), _
TopWidth(1 To nRSNw(PlanID), 1 To nProfile), HydrRadius(1 To nRSNw(PlanID), 1 To
nProfile), VelTotal(1 To nRSNw(PlanID), 1 To nProfile), _
EGElev(1 To nRSNw(PlanID), 1 To nProfile), EGSlope(1 To nRSNw(PlanID), 1 To nProfile
), FroudeXS(1 To nRSNw(PlanID), 1 To nProfile), _
NodeTypeNw(1 To nRSNw(PlanID))
Dim prof As Long, updn As Long 'No se usa la variable updn

Dim i As Long, j As Long


For prof = 1 To nProfile
j = 1
For i = 1 To nRS
If Right(Trim(RS(i)), 1) <> "*" Then
1 2 3 4 If NodeType(i) = "" Then

Page 1

You might also like