public void Read_Cable_Member()
        {
            //Input_Data

            if (CS_Analysis == null)
            {
                return;
            }
            //Results.Clear();
            List <BridgeMemberAnalysis> lst_ana = new List <BridgeMemberAnalysis>();

            if (CS_Analysis.DeadLoad_Analysis != null)
            {
                lst_ana.Add(CS_Analysis.DeadLoad_Analysis);
            }

            if (CS_Analysis.All_LL_Analysis != null)
            {
                lst_ana.AddRange(CS_Analysis.All_LL_Analysis);
            }

            //if (CS_Analysis.TotalLoad_Analysis != null) lst_ana.Add(CS_Analysis.TotalLoad_Analysis);



            if (CS_Analysis.TotalLoad_Analysis == null)
            {
                CS_Analysis.TotalLoad_Analysis = lst_ana[0];
            }
            Bridge_Analysis = CS_Analysis.TotalLoad_Analysis;


            if (Bridge_Analysis.MemberAnalysis == null)
            {
                MessageBox.Show("Analysis not done.", "ASTRA", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            List <int> list_mem = null;

            string     kStr          = MyList.RemoveAllSpaces(txt_cbl_des_mem_nos.Text.Trim().ToUpper());
            List <int> non_cable_mem = new List <int>();

            if (kStr == "ALL")
            {
                kStr = "1 TO " + Bridge_Analysis.Analysis.Members.Count;
            }
            list_mem = MyList.Get_Array_Intiger(kStr);

            CableMember cbl = new CableMember(); dgv_cable_design.Rows.Clear();

            Cable_Members.Clear();
            foreach (var item in list_mem)
            {
                cbl = new CableMember();
                cbl.User_MemberNo = item;

                AnalysisData ana = (AnalysisData)Bridge_Analysis.MemberAnalysis[item];
                if (ana != null)
                {
                    cbl.ASTRA_MemberNo = ana.AstraMemberNo;
                }

                cbl.MemberDetails = Bridge_Analysis.Analysis.Members.GetMember(item);

                List <int> l_int = new List <int>();

                l_int.Add(cbl.StartJointNo);
                l_int.Add(cbl.EndJointNo);


                CMember mem = new CMember();

                mem.Group.MemberNos.Add(item);

                mem.Result = Bridge_Analysis.GetForce(ref mem);
                if (mem.MaxTensionForce != null)
                {
                    cbl.AnalysisForce = (mem.MaxTensionForce.Force == 0.0) ? mem.MaxCompForce : mem.MaxTensionForce;
                }
                if (mem.MaxStress != null)
                {
                    cbl.AnalysisStress = mem.MaxStress;
                }
                if (cbl.MemberDetails != null)
                {
                    if (cbl.InclinationAngle > 0 && cbl.InclinationAngle < 90)
                    {
                        Cable_Members.Add(cbl);
                        dgv_cable_design.Rows.Add(cbl.ToArray_Extradosed());
                    }
                    else
                    {
                        non_cable_mem.Add(item);
                    }
                }
            }
            if (kStr == "")
            {
                MessageBox.Show(this, "Please put member nos.", "ASTRA", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                txt_cbl_des_mem_nos.Focus();
            }
            else if (non_cable_mem.Count != 0)
            {
                kStr = MyList.Get_Array_Text(non_cable_mem);


                //kStr = kStr.Replace(" ", ", ");
                MessageBox.Show(this, "Member No(s) : " + kStr + " are not Cable Member", "ASTRA", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else if (dgv_cable_design.RowCount == 0)
            {
                MessageBox.Show(this, "Member No(s) : " + kStr + " are not Cable Member", "ASTRA", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }

            grb_members.Text = "Total " + dgv_cable_design.RowCount + " Members in the List.";
        }
        private void btn_mem_ana_Click(object sender, EventArgs e)
        {
            CableMember cbl = null;

            Results = new List <string>();

            Results.Clear();
            #region TechSOFT Banner
            Results.Add("");
            Results.Add("");
            Results.Add("\t\t**********************************************");
            Results.Add("\t\t*                 ASTRA Pro                  *");
            Results.Add("\t\t*        TechSOFT Engineering Services       *");
            Results.Add("\t\t*                                            *");
            Results.Add("\t\t*        DESIGN OF STAY CABLE MEMBERS        *");
            Results.Add("\t\t*                                            *");
            Results.Add("\t\t**********************************************");
            Results.Add("\t\t----------------------------------------------");
            Results.Add("\t\tTHIS RESULT CREATED ON " + System.DateTime.Now.ToString("dd.MM.yyyy  AT HH:mm:ss") + " ");
            Results.Add("\t\t----------------------------------------------");

            #endregion



            Read_Cable_Member();
            dgv_cable_design.Rows.Clear();
            for (int i = 0; i < Cable_Members.Count; i++)
            {
                cbl = Cable_Members[i];
                Design_Cables(ref cbl);
                Results.AddRange(cbl.DesignResult.ToArray());
                dgv_cable_design.Rows.Add(cbl.ToArray_Extradosed());
            }

            #region Table Report


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


            list.Add(string.Format(""));
            list.Add(string.Format(""));

            list.Add(string.Format(""));
            list.Add(string.Format(""));
            list.Add(string.Format("Length of Central Span  [L1] = 100.0 m"));
            list.Add(string.Format("Length of Side Span 1   [L2] = 65.0 m"));
            list.Add(string.Format("Length of Side Span 2   [L3] = 65.0 m"));
            list.Add(string.Format(""));
            list.Add(string.Format("Width Along Z-direction [B] = 9.75 m"));
            list.Add(string.Format(""));
            list.Add(string.Format("Width of Cantilever Slab [B1] = 1.975 m"));
            list.Add(string.Format(""));
            list.Add(string.Format("Height of Tower [H1] = 12.0 m"));
            list.Add(string.Format("Nos of Cables [NCAB] = 6 nos"));
            list.Add(string.Format(""));
            list.Add(string.Format("Initial Cable Distance from Tower [D1] = 13.5 m"));
            list.Add(string.Format("Horizontal Distance between Two Cables [D2] = 6.0 m"));
            list.Add(string.Format("Cable Circular Diameter [cd] = 0.15 m"));
            list.Add(string.Format(""));
            list.Add(string.Format("-------------------------------------------------------------------------------------------------------------------------------------------------"));
            list.Add(string.Format("User's    Start     End     Length    Calculated     Calculated      Tensile         Allowable       Remarks         Vertical      Horizontal "));
            list.Add(string.Format("Member    Joint    Joint                Force          Stress        Capacity     Tensile Capacity                  Deflection     Deflection"));
            list.Add(string.Format(" No         No       No                                              of Cable        of Cable                        at Deck       at Pylon Top"));
            list.Add(string.Format("                             (m)        (Ton)        (Ton/Sq.m)     (N/Sq.mm)        (N/Sq.mm)                         (m)            (m)"));
            list.Add(string.Format("-------------------------------------------------------------------------------------------------------------------------------------------------"));

            string frmt = "{0,7} {1,7} {2,7} {3,10} {4,12} {5,14} {6,14} {7,16} {8,12} {9,18} {10,15} ";
            for (int i = 0; i < dgv_cable_design.RowCount; i++)
            {
                list.Add(string.Format(frmt
                                       , dgv_cable_design[1, i].Value.ToString()
                                       , dgv_cable_design[2, i].Value.ToString()
                                       , dgv_cable_design[6, i].Value.ToString()
                                       , dgv_cable_design[10, i].Value.ToString()
                                       , dgv_cable_design[12, i].Value.ToString()
                                       , dgv_cable_design[13, i].Value.ToString()
                                       , dgv_cable_design[14, i].Value.ToString()
                                       , dgv_cable_design[15, i].Value.ToString()
                                       , dgv_cable_design[16, i].Value.ToString()
                                       , dgv_cable_design[19, i].Value.ToString()
                                       , dgv_cable_design[20, i].Value.ToString()
                                       ));
            }
            list.Add(string.Format("-------------------------------------------------------------------------------------------------------------------------------------------------"));
            list.Add(string.Format(""));
            list.Add(string.Format(""));
            list.Add(string.Format(""));


            Results.InsertRange(15, list.ToArray());


            #endregion Table Report

            Results.Add("\t\t----------------------------------------------");
            Results.Add("\t\tTHIS RESULT ENDED ON " + System.DateTime.Now.ToString("dd.MM.yyyy  AT HH:mm:ss") + " ");
            Results.Add("\t\t----------------------------------------------");

            File.WriteAllLines(Cable_Design_Report, Results.ToArray());
            Results.Clear();

            iApp.View_Result(Cable_Design_Report);
            //try
            //{
            Button_Enable_Disable();
        }
        public void Design_Cables(ref CableMember mem)
        {
            double Ax      = Cable_Ax;
            double gamma   = Cable_Gamma;
            double alpha_x = mem.InclinationAngle * (Math.PI / 180);
            double na      = 0.0;
            double n       = 0.0;
            double a       = 0.0;
            double E       = Cable_E;
            double Fx      = 0.0;
            double f       = Cable_f;

            double x1, y1, z1;
            double x2, y2, z2;
            double x3, y3, z3;

            Fx = mem.AnalysisForce.Force;

            x1 = mem.MemberDetails.StartNode.X;
            y1 = mem.MemberDetails.StartNode.Y;
            z1 = mem.MemberDetails.StartNode.Z;

            x2 = mem.MemberDetails.EndNode.X;
            y2 = mem.MemberDetails.EndNode.Y;
            z2 = mem.MemberDetails.EndNode.Z;


            x3 = x1;
            y3 = y2;
            z3 = z2;

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

            //list.Add(string.Format("Cross Sectional Area of Cable [Ax] = {0} sq.mm", Ax));
            //list.Add(string.Format("Angle of Inclination of Cable [alpha_x] = {0} ", alpha_x));
            //list.Add(string.Format("Horizontal Projection of Cable Length [na] = {0} ", na));
            //list.Add(string.Format("Number of Panels up to the Cable = {0} ", n));
            //list.Add(string.Format("Length of Each Panel = {0} "));
            //list.Add(string.Format("Elastic Modulus of Cable Material = {0} "));
            //list.Add(string.Format("Force in the Cable [Fx] = {0} ", Fx));

            list.Add(string.Format(""));
            list.Add(string.Format("------------------------------------------------------------------------------"));
            list.Add(string.Format(""));
            list.Add(string.Format(""));
            list.Add(string.Format("User's Cable No : {0}", mem.User_MemberNo));
            list.Add(string.Format("ASTRA's Cable No : {0} ", mem.ASTRA_MemberNo));
            list.Add(string.Format("Joint Coorinate at Upper End : {0} [x1 : {1:f3}, y1 : {2:f3}, z1 : {3:f3}]", mem.StartJointNo, mem.StartJoint_X, mem.StartJoint_Y, mem.StartJoint_Z));
            list.Add(string.Format("Joint Coorinate at Lower End : {0} [x2 : {1:f3}, y2 : {2:f3}, z2 : {3:f3}]", mem.EndJointNo, mem.EndJoint_X, mem.EndJoint_Y, mem.EndJoint_Z));
            list.Add(string.Format(""));
            list.Add(string.Format("Provided Cable Cross Section Diameter = d = {0:f3} m", Cable_D));
            list.Add(string.Format("Provided Cable Cross Section Area     = π*d^2/4 = {0:E3} sq.m", Cable_Ax));
            list.Add(string.Format(""));
            list.Add(string.Format("Provided Permissible Shear Stress [f] = {0} N/sq.mm = {1} Ton/sq.m", f, (f = f * 100)));
            list.Add(string.Format("Specific Weight of Cable Material [γ] = {0} Ton/cu.m", gamma));
            list.Add(string.Format(""));


            list.Add(string.Format("Specific Weight of Cable [γ] = {0} Ton/cu.m", gamma));
            list.Add(string.Format(""));
            list.Add(string.Format("Analysis Force :  {0:E3} Ton           [Member No :{1}, LoadCase : {2}]", mem.AnalysisForce, mem.AnalysisForce.MemberNo, mem.AnalysisForce.Loadcase));
            list.Add(string.Format("Analysis Stress : {0:E3} Ton/sq.m      [Member No :{1}, LoadCase : {2}]", mem.AnalysisStress, mem.AnalysisStress.MemberNo, mem.AnalysisStress.Loadcase));
            list.Add(string.Format(""));
            list.Add(string.Format("Pylon Coordinate at Deck : {0} m", mem.StartJoint_Y));
            list.Add(string.Format(""));
            double Lx = Math.Sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2) + (z1 - z2) * (z1 - z2));
            double Lh = Math.Sqrt((x2 - x3) * (x2 - x3) + (y2 - y3) * (y2 - y3) + (z2 - z3) * (z2 - z3));
            double Lv = Math.Sqrt((x1 - x3) * (x1 - x3) + (y1 - y3) * (y1 - y3) + (z1 - z3) * (z1 - z3));

            //list.Add(string.Format("Length of Cable = Lx = SQRT((x1 - x2)^2 + (y1 - y2)^2 + (z1 - z2)^2) = {0:f3} m", Lx));
            list.Add(string.Format("Length of Cable = Lx = {0:f3} m", Lx));
            list.Add(string.Format(""));
            //list.Add(string.Format("Length of Horizontal Projection = Lh = SQRT((x2 - x3)^2 + (y2 - y3)^2 + (z2 - z3)^2) = {0:f3} m", Lh));
            list.Add(string.Format("Length of Horizontal Projection = Lh = {0:f3} m", Lh));
            list.Add(string.Format(""));
            //list.Add(string.Format("Length of Horizontal Projection = Lv = SQRT((x1 - x3)^2 + (y1 - y3)^2 + (z1 - z3)^2) = {0:f3} m", Lv));
            list.Add(string.Format("Length of Vertical Projection = Lv = {0:f3} m", Lv));
            list.Add(string.Format(""));
            alpha_x = mem.MemberDetails.InclinationAngle_in_Radian;
            list.Add(string.Format("Inclination Angle of Cable = α_x"));
            list.Add(string.Format("                           = tan^(-1)[(y2-y1)/(x2-x1)]", Lv));
            list.Add(string.Format("                           = {0:f0}° (degree)", mem.InclinationAngle));
            list.Add(string.Format(""));
            list.Add(string.Format(""));


            double Pu = Fx * Math.Sin(alpha_x);

            list.Add(string.Format(""));
            list.Add(string.Format("Vertical Component of Force = Pu = Fx * Sin α_x"));
            list.Add(string.Format(""));
            list.Add(string.Format("                                 = {0:E3} * {1:F3}", Fx, Math.Sin(alpha_x)));
            list.Add(string.Format("                                 = {0:E3} Ton", Pu));
            list.Add(string.Format(""));
            list.Add(string.Format(""));

            Ax = Fx / f;
            list.Add(string.Format("Required Cross Section Area = Ax = Fx / f"));
            list.Add(string.Format("                                 = {0:E3} / {1}", Fx, f));
            list.Add(string.Format("                                 = {0:E3} sq.m", Ax));
            list.Add(string.Format(""));
            list.Add(string.Format("Provided Cable Cross Section Area = {0:E3} sq.m", Cable_Ax));
            list.Add(string.Format(""));
            list.Add(string.Format(""));

            double W = Cable_Ax * Lx * gamma;

            list.Add(string.Format("Weight of Cable = W = Ax * Lx * γ "));
            list.Add(string.Format("                = {0:E3} * {1:f3} * {2}", Cable_Ax, Lx, gamma));
            list.Add(string.Format("                = {0:E3} Ton", W));
            list.Add(string.Format(""));



            //list.Add(string.Format(""));
            //list.Add(string.Format(""));
            //list.Add(string.Format("Calculated Force = Fx"));
            //list.Add(string.Format("                 = Pu/Sin α_x"));
            //list.Add(string.Format("                 = {0:E3}/{1:f3}", Pu, Math.Sin(alpha_x)));
            //list.Add(string.Format("                 = {0:E3} Ton", Fx));
            //list.Add(string.Format(""));

            mem.CalculatedStress = Fx / Ax;
            //list.Add(string.Format("Calculated Stress = Fx / Ax "));
            //list.Add(string.Format("                  =  Pu/(Sin α_x * Ax)"));
            //list.Add(string.Format("                  =  {0:E3}/({1:F3} * {2:E3})", Pu, Math.Sin(alpha_x), Ax));
            //list.Add(string.Format("                  =  {0:E3} Ton/sq.m", mem.CalculatedStress));
            list.Add(string.Format(""));
            list.Add(string.Format("E = Stress / Strain"));
            mem.Strain = (Fx / Cable_Ax) / E;
            list.Add(string.Format("Strain = Stress / E  "));
            list.Add(string.Format("       = (Fx / Ax) / E  "));
            list.Add(string.Format("       = ({0:E3}/{1:E3}) / {2:E3}", Fx, Cable_Ax, E));
            list.Add(string.Format("       = {0:E3} ", mem.Strain));
            list.Add(string.Format(""));
            list.Add(string.Format(""));
            list.Add(string.Format("Strain  = Elongation / Lx"));

            mem.Elongation = mem.Strain * Lx;
            list.Add(string.Format(""));

            list.Add(string.Format("Elongation in Cable = δx = Strain * Lx"));
            list.Add(string.Format("                         = {0:E3} * {1:E3} ", mem.Strain, Lx));
            list.Add(string.Format("                         = {0:E3}  m", mem.Elongation));
            list.Add(string.Format(""));
            list.Add(string.Format("Vertical Deflection of Deck at joint x2 = δhn = δx / Sin α_x"));
            list.Add(string.Format("                                              = {0:E3} / {1:f3}", mem.Elongation, Math.Sin(alpha_x)));
            list.Add(string.Format("                                              = {0:E3} m", mem.Vertical_Deflection_at_Deck));
            list.Add(string.Format(""));
            list.Add(string.Format("Horizontal Deflection at Pylon Top      = δhx = δx/Cos α_x "));
            list.Add(string.Format("                                              = {0:E3} / {1:f3}", mem.Elongation, Math.Cos(alpha_x)));
            list.Add(string.Format("                                              = {0:E3} m", mem.Horizontal_Deflection_at_Pylon_Top));
            list.Add("");
            list.Add("");
            list.Add("");
            list.Add("");
            list.Add(string.Format("------------------------------------------------------------------------------"));
            list.Add("");
            list.Add("");

            mem.DesignResult.Clear();
            mem.DesignResult.AddRange(list.ToArray());
        }