Esempio n. 1
0
        private void btn_ok_Click(object sender, EventArgs e)
        {
            List <string> HEADS_Data = new List <string>();

            frm_GroundModeling ff = new frm_GroundModeling(WorkingFolder);

            ff.Owner = this;

            bool flag = !(HeadsUtils.Constants.BuildType == HeadsUtils.eHEADS_RELEASE_TYPE.DEMO);

            if (ff.ShowDialog() == DialogResult.OK)
            {
                string exe_file = flag ? "DTM_Pro.EXE" : "DTM_Demo.EXE";
                exe_file = Path.Combine(Application.StartupPath, exe_file);

                //HEADS
                HEADS_Data.Add("HEADS");
                //100,DGM
                HEADS_Data.Add("100,DGM");
                //101,BOU,MODEL=BOUND,STRING=BDRY
                HEADS_Data.Add("101,BOU,MODEL=" + txt_model.Text + ",STRING=" + txt_string.Text);
                //FINISH
                HEADS_Data.Add("FINISH");

                string Temp_File = Path.Combine(WorkingFolder, "inp.tmp");

                File.WriteAllLines(Temp_File, HEADS_Data.ToArray());
                try
                {
                    File.WriteAllText(Path.Combine(Application.StartupPath, "hds.001"), Temp_File);
                    File.WriteAllText(Path.Combine(Application.StartupPath, "hds.002"), WorkingFolder + "\\");
                    FileInfo finfo = new FileInfo(Temp_File);
                    if (finfo.IsReadOnly)
                    {
                        finfo.IsReadOnly = false;
                    }
                }
                catch (Exception exx)
                {
                }
                System.Environment.SetEnvironmentVariable("DEM0", Temp_File);
                System.Environment.SetEnvironmentVariable("SURVEY", Temp_File);
                System.Environment.SetEnvironmentVariable("HDSPATH", Application.StartupPath + "\\");

                if (File.Exists(exe_file))
                {
                    System.Diagnostics.Process.Start(exe_file);
                }
                else
                {
                    MessageBox.Show(exe_file + " file not found.", "ASTRA");
                }
                DialogResult = DialogResult.OK;
                this.Close();
            }
        }
Esempio n. 2
0
        public bool RunProgram()
        {
            //vd_pl.
            try
            {
                List <string> HEADS_Data = new List <string>();
                string        str        = "";
                string        exe_file   = "DGM2.EXE";
                this.checkMasterString_.Checked = true;
                if (chainage_points == null)
                {
                    chainage_points = new List <CPTStype>();
                }
                chainage_points.Clear();
                ProcessData();
                Vertexes vtx = new Vertexes(ptCords);
                this.checkMasterString_.Checked = false;
                ptCords.RemoveAll();
                for (int i = 0; i < chainage_points.Count; i++)
                {
                    ptCords.Add(new gPoint(chainage_points[i].mx, chainage_points[i].my, chainage_points[i].mz));
                }
                ptCords = Get_OffSet_Points(ptCords);


                SurveyDataCollection s_data_col = new SurveyDataCollection(txt_select_survey_data.Text);
                s_data_col.Write_Model("");

                s_data_col.Write_Model(ptCords, txt_model.Text, txt_string.Text, WorkingPath);
                s_data_col.Write_Model(ptCords, txt_model.Text + "%%", txt_string.Text, WorkingPath);


                frm_GroundModeling ff = new frm_GroundModeling(Survey_File);
                ff.Owner = this;

                bool flag = !(HeadsUtils.Constants.BuildType == eHEADS_RELEASE_TYPE.DEMO);
                if (ff.ShowDialog() == DialogResult.OK)
                {
                    exe_file = flag ? "DTM_Pro.EXE" : "DTM_Demo.EXE";
                    //HEADS
                    HEADS_Data.Add("HEADS");
                    //100,DGM
                    HEADS_Data.Add("100,DGM");
                    //101,BOU,MODEL=BOUND,STRING=BDRY
                    HEADS_Data.Add("101,BOU,MODEL=" + txt_model.Text + ",STRING=" + txt_string.Text);
                    //FINISH
                    HEADS_Data.Add("FINISH");
                    File.WriteAllLines(Temp_File, HEADS_Data.ToArray());
                    SetEnvironmentVar(Temp_File);
                    //MessageBox.Show("3");
                    RunExe(exe_file);
                }
                exe_file = "DGCONT.EXE";
                exe_file = flag ? "DGCONT_Pro.EXE" : "DGCONT_Demo.EXE";

                HEADS_Data.Clear();
                //HEADS
                HEADS_Data.Add("HEADS");
                //100,DGM
                HEADS_Data.Add("100,DGM");
                //104,CON,MODEL=CONTOUR,STRING=C001,INC=1.0
                str = string.Format("104,CON,MODEL={0},STRING={1},INC={2}",
                                    txt_pri_model.Text,
                                    txt_pri_string.Text,
                                    txt_pri_inc.Text);
                HEADS_Data.Add(str);
                //104,CON,MODEL=CONTOUR,STRING=C005,INC=5.0
                str = string.Format("104,CON,MODEL={0},STRING={1},INC={2}",
                                    txt_sec_model.Text,
                                    txt_sec_string.Text,
                                    txt_sec_inc.Text);
                HEADS_Data.Add(str);
                //105,TXT,MODEL=CONTOUR,STRING=ELE2,INC=5.0,TSI=5
                str = string.Format("105,TXT,MODEL={0},STRING={1},INC={2}",
                                    txt_ele_model.Text,
                                    txt_ele_string.Text,
                                    txt_ele_inc.Text);
                HEADS_Data.Add(str);
                //FINISH
                str = "FINISH";
                HEADS_Data.Add(str);
                File.WriteAllLines(Temp_File, HEADS_Data.ToArray());
                SetEnvironmentVar(Temp_File);
                RunExe(exe_file);
            }
            catch (Exception ex) { }
            return(true);
        }