public String ReadData()
        {
            HECRASController hrc = new HECRASController();

            hrc.Project_Open(@"C:\Users\hqngh\OneDrive\Documents\Hello World Coupling\HelloWorldCoupling.prj");

            int    nmsg   = 0;
            bool   block  = true;
            Array  sa     = null;
            String result = "";

            try
            {
                hrc.Compute_HideComputationWindow();

                hrc.Compute_CurrentPlan(ref nmsg, ref sa);
            }
            catch (Exception ex)
            {
                result = ex.ToString();
            }
            hrc.Project_Close();
            hrc.QuitRas();
            return(result);
        }
Example #2
0
    void Start()
    {
        hrc = new HECRASController();
        //--------------------------------------------
        int   nmsg  = 0;
        bool  block = true;
        Array sa    = null;

        hrc.Project_Open("C:/Users/admin/Documents/HEC Data/HEC-RAS/Example Projects/1D Steady Flow Hydraulics/Chapter 4 Example Data/Ex1.prj");
        Debug.Log(hrc.Project_Current());
        Debug.Log(hrc.CurrentGeomFile());
        Debug.Log(hrc.CurrentSteadyFile());
        Debug.Log(hrc.CurrentProjectFile());
        Debug.Log(hrc.CurrentPlanFile());
        hrc.Compute_ShowComputationWindow();

        try
        {
            hrc.Compute_CurrentPlan(ref nmsg, ref sa, ref block);
        }
        catch (Exception e)
        {
            Console.WriteLine(e.ToString());
        }
        //hrc = null; //kills the process faster than waiting for GC
        //--------------------------------------------
        //Console.WriteLine("Press any key to quit.");
        //Console.ReadKey();
        hrc.Project_Save();
        hrc.Project_Close();
        hrc.QuitRas();
    }
        public string Compute_CurrentPlan()
        {
            int   nmsg  = 0;
            bool  block = true;
            Array arr   = null;// CreateInstance(typeof(string), 0);
            //string[] arr = new string[1] {null};
            string result = "";

            try
            {
                hrc.Compute_HideComputationWindow();
                result = hrc.CurrentGeomHDFFile();
                hrc.Compute_CurrentPlan(0, null, true);

                /*
                 * hrc.Output_Initialize();
                 * hrc.Output_ComputationLevel_Export("E:\\aa.txt", result, true,true,true,true);
                 * //hrc.ShowRasMapper();
                 * hrc.ExportGIS();
                 * hrc.Output_GetProfiles(0,arr);
                 * hrc.PlotPFGeneral("", "");
                 * hrc.ShowRas();
                 * hrc.Geometry().Save();
                 */
                //Console.WriteLine(hrc.Plan_GetFilename());
            }
            catch (Exception ex)
            {
                result = ex.ToString();
            }
            //hrc.Project_Close();
            //hrc.QuitRas();
            hrc = null;
            return(result);
        }