Пример #1
0
        private void Design_IRC_Abutment_Bridges_Box_Type_IRC()
        {
            string file_path = Get_Project_Folder();

            //file_path = Path.Combine(file_path, "BoQ_Bridges_Box_Type.xlsx");


            file_path = Path.Combine(file_path, "Counterfort Abutment Limit State Design [IRC].xlsm");

            string copy_path = file_path;

            //file_path = Path.Combine(Application.StartupPath, @"DESIGN\Abutment\Abutment Design IRC\IRC Abutment Design.xlsx");
            file_path = Path.Combine(Application.StartupPath, @"DESIGN\Abutment\Counterfort Abutment LS\Counterfort Abutment Limit State Design [IRC].xlsm");

            if (File.Exists(file_path))
            {
                File.Copy(file_path, copy_path, true);
            }

            iapp.Excel_Open_Message();

            Excel.Application myExcelApp;
            Excel.Workbooks   myExcelWorkbooks;
            Excel.Workbook    myExcelWorkbook;

            object misValue = System.Reflection.Missing.Value;

            myExcelApp         = new Excel.ApplicationClass();
            myExcelApp.Visible = true;
            myExcelWorkbooks   = myExcelApp.Workbooks;


            myExcelWorkbook = myExcelWorkbooks.Open(copy_path, 0, false, 5, "2011ap", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);

            Excel.Worksheet myExcelWorksheet = (Excel.Worksheet)myExcelWorkbook.Sheets["DLSUP"];


            if (rbtn_calculated.Checked == false)
            {
                //myExcelWorksheet.get_Range("F179").Formula = Reaction_A;
                //myExcelWorksheet.get_Range("F181").Formula = Reaction_B;

                myExcelWorksheet.get_Range("F179").Formula = Reaction_A;
                myExcelWorksheet.get_Range("F181").Formula = Reaction_A;



                myExcelWorksheet.get_Range("G179").Formula = "(Values Taken from Analysis / User)";
                myExcelWorksheet.get_Range("G181").Formula = "(Values Taken from Analysis / User)";
            }


            List <string> list = new List <string>();



            DataGridView dgv   = dgv_input_data;
            int          rindx = 0;


            #region Design Data
            myExcelWorksheet = (Excel.Worksheet)myExcelWorkbook.Sheets["Design Data"];

            rindx = 0;

            dgv = dgv_input_data;



            DataInputCollections dips = new DataInputCollections();

            dips.Load_Data_from_Grid(dgv);
            List <string> ldbl = new List <string>();

            //for (int i = 0; i < dgv.RowCount; i++)
            //{
            //    try
            //    {
            //        if (dgv[1, i].Value.ToString() != "")
            //            ldbl.Add(dgv[1, i].Value.ToString());
            //    }
            //    catch (Exception exx) { }
            //}


            rindx = 0;

            for (int i = 7; i < 123; i++)
            {
                if ((i >= 12 && i <= 14) ||
                    (i >= 22 && i <= 25) ||
                    (i >= 30 && i <= 31) ||
                    (i >= 36 && i <= 37) ||
                    (i >= 40 && i <= 41) ||
                    (i >= 47 && i <= 48) ||
                    (i >= 52 && i <= 53) ||
                    (i >= 58 && i <= 59) ||
                    (i >= 68 && i <= 70) ||
                    (i >= 72 && i <= 74) ||
                    (i >= 88 && i <= 90) ||
                    (i >= 92 && i <= 94) ||
                    (i >= 98 && i <= 100) ||
                    (i >= 103 && i <= 105) ||
                    (i >= 110 && i <= 116)
                    )
                {
                    continue;
                }
                else
                {
                    //myExcelWorksheet.get_Range("E" + i).Formula = dips[rindx++].DATA.ToString();

                    if (rindx == 60)
                    {
                        myExcelWorksheet.get_Range("E" + i).Formula = dips[rindx++].DATA.ToUpper().Replace("M", "").Trim().ToString();

                        //myExcelWorksheet.get_Range("E" + i).Formula = dips[rindx].DATA.ToUpper().Replace("M", "").Trim().ToString();
                    }
                    else if (rindx == 61)
                    {
                        //myExcelWorksheet.get_Range("E" + i).Formula = dips[rindx].DATA.ToUpper().Replace("M", "").Trim().ToString();
                        myExcelWorksheet.get_Range("E" + i).Formula = dips[rindx++].DATA.ToUpper().Replace("FE", "").Trim().ToString();
                    }
                    else
                    {
                        myExcelWorksheet.get_Range("E" + i).Formula = dips[rindx++].DATA.ToString();
                    }
                }
            }
            #endregion Design Data


            rindx = 0;

            myExcelWorkbook.Save();

            releaseObject(myExcelWorkbook);
            iapp.Excel_Close_Message();
        }
Пример #2
0
        private void Design_IRC_Abutment_Bridges_Box_Type_BS()
        {
            string file_path = Get_Project_Folder();

            //file_path = Path.Combine(file_path, "BoQ_Bridges_Box_Type.xlsx");


            file_path = Path.Combine(file_path, "Counterfort Abutment Limit State Design [BS].xlsm");

            string copy_path = file_path;

            //file_path = Path.Combine(Application.StartupPath, @"DESIGN\Abutment\Abutment Design IRC\IRC Abutment Design.xlsx");
            file_path = Path.Combine(Application.StartupPath, @"DESIGN\Abutment\Counterfort Abutment LS\Counterfort Abutment Limit State Design [BS].xlsm");

            if (File.Exists(file_path))
            {
                File.Copy(file_path, copy_path, true);
            }
            else
            {
                return;
            }

            Excel.Application myExcelApp;
            Excel.Workbooks   myExcelWorkbooks;
            Excel.Workbook    myExcelWorkbook;

            object misValue = System.Reflection.Missing.Value;

            myExcelApp         = new Excel.ApplicationClass();
            myExcelApp.Visible = true;
            myExcelWorkbooks   = myExcelApp.Workbooks;

            iapp.Excel_Open_Message();


            myExcelWorkbook = myExcelWorkbooks.Open(copy_path, 0, false, 5, "2011ap", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);

            Excel.Worksheet myExcelWorksheet = (Excel.Worksheet)myExcelWorkbook.Sheets["DLSUP"];


            if (rbtn_calculated.Checked == false)
            {
                myExcelWorksheet.get_Range("F179").Formula = Reaction_A;
                myExcelWorksheet.get_Range("F181").Formula = Reaction_B;
            }


            List <string> list = new List <string>();



            DataGridView dgv   = dgv_input_data;
            int          rindx = 0;
            int          i     = 0;


            #region Design Data
            myExcelWorksheet = (Excel.Worksheet)myExcelWorkbook.Sheets["Design Data"];

            rindx = 0;

            dgv = dgv_input_data;



            DataInputCollections dips = new DataInputCollections();

            dips.Load_Data_from_Grid(dgv);
            List <string> ldbl = new List <string>();

            //for (int i = 0; i < dgv.RowCount; i++)
            //{
            //    try
            //    {
            //        if (dgv[1, i].Value.ToString() != "")
            //            ldbl.Add(dgv[1, i].Value.ToString());
            //    }
            //    catch (Exception exx) { }
            //}


            rindx = 0;

            for (i = 7; i < 123; i++)
            {
                if ((i >= 12 && i <= 14) ||
                    (i >= 22 && i <= 25) ||
                    (i >= 30 && i <= 31) ||
                    (i >= 36 && i <= 37) ||
                    (i >= 40 && i <= 41) ||
                    (i >= 47 && i <= 48) ||
                    (i >= 52 && i <= 53) ||
                    (i >= 58 && i <= 59) ||
                    (i >= 68 && i <= 70) ||
                    (i >= 72 && i <= 74) ||
                    (i >= 88 && i <= 90) ||
                    (i >= 92 && i <= 94) ||
                    (i >= 98 && i <= 100) ||
                    (i >= 103 && i <= 105) ||
                    (i >= 110 && i <= 116)
                    )
                {
                    continue;
                }
                else
                {
                    if (rindx == 60)
                    {
                        myExcelWorksheet.get_Range("E" + i).Formula = dips[rindx++].DATA.ToUpper().Replace("M", "").Trim().ToString();

                        //myExcelWorksheet.get_Range("E" + i).Formula = dips[rindx].DATA.ToUpper().Replace("M", "").Trim().ToString();
                    }
                    else if (rindx == 61)
                    {
                        //myExcelWorksheet.get_Range("E" + i).Formula = dips[rindx].DATA.ToUpper().Replace("M", "").Trim().ToString();
                        myExcelWorksheet.get_Range("E" + i).Formula = dips[rindx++].DATA.ToUpper().Replace("FE", "").Trim().ToString();
                    }
                    else
                    {
                        myExcelWorksheet.get_Range("E" + i).Formula = dips[rindx++].DATA.ToString();
                    }
                }
            }
            #endregion Design Data

            #region cwll

            myExcelWorksheet = (Excel.Worksheet)myExcelWorkbook.Sheets["cwll"];


            List <string> xls_cell = new List <string>();
            xls_cell.Add("Q");
            xls_cell.Add("R");
            xls_cell.Add("S");
            xls_cell.Add("T");
            xls_cell.Add("U");
            xls_cell.Add("V");
            xls_cell.Add("W");


            List <double> load1 = new List <double>();
            List <double> dist1 = new List <double>();

            List <double> load2 = new List <double>();
            List <double> dist2 = new List <double>();


            i = 0;

            for (i = 0; i < dgv_bs_ll_1.RowCount; i++)
            {
                try
                {
                    load1.Add(MyList.StringToDouble(dgv_bs_ll_1[1, i].Value.ToString(), 0.0));
                    if (i > 0)
                    {
                        dist1.Add(MyList.StringToDouble(dgv_bs_ll_1[2, i].Value.ToString(), 0.0));
                    }
                }
                catch (Exception exx1) { }
            }


            for (i = 0; i < dgv_bs_ll_2.RowCount; i++)
            {
                try
                {
                    load2.Add(MyList.StringToDouble(dgv_bs_ll_2[1, i].Value.ToString(), 0.0));
                    if (i > 0)
                    {
                        dist2.Add(MyList.StringToDouble(dgv_bs_ll_2[2, i].Value.ToString(), 0.0));
                    }
                }
                catch (Exception exx1) { }
            }



            #region HB Load 1

            int    cell = 26;
            string kStr = "";



            //myExcelWorksheet.get_Range("Q25").Formula = cmb_bs_ll_1.Text + " Loading";
            myExcelWorksheet.get_Range("Q25").Formula = cmb_bs_ll_1.Text;

            for (i = 0; i < xls_cell.Count; i++)
            {
                kStr = xls_cell[i] + cell;

                if (i < load1.Count)
                {
                    myExcelWorksheet.get_Range(kStr).Formula = load1[i].ToString();
                }
                else
                {
                    myExcelWorksheet.get_Range(kStr).Formula = "";
                }
            }
            cell = 27;
            for (i = 1; i < xls_cell.Count; i++)
            {
                kStr = xls_cell[i] + cell;


                if ((i - 1) < dist1.Count)
                {
                    myExcelWorksheet.get_Range(kStr).Formula = dist1[i - 1].ToString();
                }
                else
                {
                    myExcelWorksheet.get_Range(kStr).Formula = "";
                }
            }


            #endregion HA Load 1

            #region HB Load 2

            xls_cell.Insert(0, "P");

            cell = 64;
            kStr = "";
            //myExcelWorksheet.get_Range("P63").Formula = cmb_bs_ll_2.Text + " Loading";
            myExcelWorksheet.get_Range("P63").Formula = cmb_bs_ll_2.Text;

            for (i = 0; i < xls_cell.Count; i++)
            {
                kStr = xls_cell[i] + cell;

                if (i < load1.Count)
                {
                    myExcelWorksheet.get_Range(kStr).Formula = load1[i].ToString();
                }
                else
                {
                    myExcelWorksheet.get_Range(kStr).Formula = "";
                }
            }
            cell = 65;
            for (i = 1; i < xls_cell.Count; i++)
            {
                kStr = xls_cell[i] + cell;


                if ((i - 1) < dist1.Count)
                {
                    myExcelWorksheet.get_Range(kStr).Formula = dist1[i - 1].ToString();
                }
                else
                {
                    myExcelWorksheet.get_Range(kStr).Formula = "";
                }
            }


            #endregion HA Load 2



            #endregion cwll


            rindx = 0;

            myExcelWorkbook.Save();

            releaseObject(myExcelWorkbook);
        }
Пример #3
0
        private void Box_Culvert_Single_Cell()
        {
            string file_path = Path.Combine(iApp.LastDesignWorkingFolder, Title);

            if (iApp.user_path != "")
            {
                file_path = Path.Combine(iApp.user_path, Title);
            }

            if (!Directory.Exists(file_path))
            {
                Directory.CreateDirectory(file_path);
            }

            //file_path = Path.Combine(file_path, "RCC Cantilever Abutment Design");

            //if (!Directory.Exists(file_path)) Directory.CreateDirectory(file_path);

            file_path = Path.Combine(file_path, "Single cell box.xlsx");

            //file_path = Path.Combine(file_path, "BoQ_Flyover_ROB_RUBs.xlsx");
            //file_path = Path.Combine(file_path, "BoQ for " + cmb_boq_item.Text + ".xlsx");

            string copy_path = file_path;

            file_path = Path.Combine(Application.StartupPath, @"DESIGN\Limit State Method\Box Culvert\Single cell box.xlsx");

            if (File.Exists(file_path))
            {
                File.Copy(file_path, copy_path, true);
            }
            else
            {
                MessageBox.Show(file_path + " file not found.");
                return;
            }


            iApp.Excel_Open_Message();

            Excel.Application myExcelApp;
            Excel.Workbooks   myExcelWorkbooks;
            Excel.Workbook    myExcelWorkbook;

            object misValue = System.Reflection.Missing.Value;

            myExcelApp         = new Excel.ApplicationClass();
            myExcelApp.Visible = true;
            //myExcelApp.Visible = false;
            myExcelWorkbooks = myExcelApp.Workbooks;

            //myExcelWorkbook = myExcelWorkbooks.Open(fileName, misValue, misValue, misValue, misValue, misValue, misValue, misValue, misValue, misValue, misValue, misValue, misValue, misValue, misValue);

            myExcelWorkbook = myExcelWorkbooks.Open(copy_path, 0, false, 5, "2011ap", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);

            //Excel.Worksheet myExcelWorksheet = (Excel.Worksheet)myExcelWorkbook.ActiveSheet;
            Excel.Worksheet myExcelWorksheet = (Excel.Worksheet)myExcelWorkbook.Sheets["Design Data"];



            List <double> data = new List <double>();

            try
            {
                if (false)
                {
                    List <string> list = new List <string>();



                    DataGridView dgv   = dgv_design_data_single;
                    int          rindx = 0;
                    int          i     = 0;


                    #region Design Data
                    myExcelWorksheet = (Excel.Worksheet)myExcelWorkbook.Sheets["Design Data"];

                    rindx = 0;

                    dgv = dgv_design_data_single;



                    DataInputCollections dips = new DataInputCollections();

                    dips.Load_Data_from_Grid(dgv);
                    List <string> ldbl = new List <string>();

                    rindx = 0;

                    for (i = 6; i < 68; i++)
                    {
                        if ((i >= 12 && i <= 26) ||
                            (i >= 22 && i <= 30) ||
                            (i >= 30 && i <= 31) ||
                            (i >= 36 && i <= 37) ||
                            (i >= 40 && i <= 41) ||
                            (i >= 47 && i <= 48) ||
                            (i >= 52 && i <= 53) ||
                            (i >= 58 && i <= 59) ||
                            (i >= 68 && i <= 70) ||
                            (i >= 72 && i <= 74) ||
                            (i >= 88 && i <= 90) ||
                            (i >= 92 && i <= 94) ||
                            (i >= 98 && i <= 100) ||
                            (i >= 103 && i <= 105) ||
                            (i >= 110 && i <= 116)
                            )
                        {
                            continue;
                        }
                        else
                        {
                            if (rindx == 60)
                            {
                                myExcelWorksheet.get_Range("G" + i).Formula = dips[rindx++].DATA.ToUpper().Replace("M", "").Trim().ToString();

                                //myExcelWorksheet.get_Range("E" + i).Formula = dips[rindx].DATA.ToUpper().Replace("M", "").Trim().ToString();
                            }
                            else if (rindx == 61)
                            {
                                //myExcelWorksheet.get_Range("E" + i).Formula = dips[rindx].DATA.ToUpper().Replace("M", "").Trim().ToString();
                                myExcelWorksheet.get_Range("G" + i).Formula = dips[rindx++].DATA.ToUpper().Replace("FE", "").Trim().ToString();
                            }
                            else
                            {
                                myExcelWorksheet.get_Range("G" + i).Formula = dips[rindx++].DATA.ToString();
                            }
                        }
                    }
                    #endregion Design Data


                    rindx = 0;
                }
            }
            catch (Exception exx) { }

            iApp.Excel_Close_Message();

            myExcelWorkbook.Save();

            releaseObject(myExcelWorkbook);

            //iApp.Excel_Open_Message();
        }