HECRAS Controller in other language

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

HECRAS Controller in other language

kevin
I bought the book "breaking the hec-ras code" and really like the insights. Learnt a lot by following the examples in the book. For example, we can do the following in VBA:

    Dim lngNum_RS As Long
    Dim strRS() As String  'Name of the river reach
    Dim strNodeType() As String

    lngRiverID = 1
    lngReachID = 1
    RC.Geometry_GetNodes lngRiverID, lngReachID, lngNum_RS, strRS(), strNodeType()

The number of river reaches can be passed to the argument lngNum_RS. But in other languages (for example, python), this "passing by reference" mechanism might not work and with python, I can't get the number of river reaches in the same way.

I think my question is, what is the general rule to use this type of "passing by reference" functions in HECRAS Controller with python? Do we have a document for the HECRASController COM in python?

Thank you!
Reply | Threaded
Open this post in threaded view
|

Re: HECRAS Controller in other language

Chris G.
Administrator
Kevin-

I wish there was a document that covers some RASController coding strategies in python.  More and more people are using python with the RASController, so I know it can be done.  

One alternative way you might consider is to read your geometry directly from the geometry input file.  Chapter 4 of the book covers this topic and Appendix B has all of the geometry input file keys

Chris
Chris G.
@RASModel
www.therassolution.com
Reply | Threaded
Open this post in threaded view
|

Re: HECRAS Controller in other language

kevin
Chris, thank you for your reply!

I totally agree. If someone starts a project to make python code for example cases and document them, many users would be interested in participating.

At this point, it would be very helpful if any experienced user could point out the general rule to call the functions (with return value in arguments by reference) in python. 

Thanks!

On Thu, Jul 27, 2017 at 6:50 AM, Chris G. [via HEC-RAS Help] <[hidden email]> wrote:
Kevin-

I wish there was a document that covers some RASController coding strategies in python.  More and more people are using python with the RASController, so I know it can be done.  

One alternative way you might consider is to read your geometry directly from the geometry input file.  Chapter 4 of the book covers this topic and Appendix B has all of the geometry input file keys

Chris
Chris G.
@RASModel
www.therassolution.com



If you reply to this email, your message will be added to the discussion below:
http://hec-ras-help.1091112.n5.nabble.com/HECRAS-Controller-in-other-language-tp4267p4276.html
To unsubscribe from HECRAS Controller in other language, click here.
NAML

Max
Reply | Threaded
Open this post in threaded view
|

Re: HECRAS Controller in other language

Max
In reply to this post by kevin
I am starting on C++ project to interact with HEC-RAS and so am interested in this forum and will probably purchase the "Breaking the HEC-RAS Code" book.
However, I have found that you can look inside the ras.exe from within VisualStudio (menu view->object browser, then select Custom Component Set, click on the "..." button and find the HEC River Analysis System under the COM tab). From there you can see at least the functions and their parameters.

Stay tuned as this project develops.