Exemple #1
0
        public static bool Get_Demo_Data(Form frm)
        {
            if (Demo_Data == null)
            {
                Demo_Data = new List <string>();
            }

            if (Demo_Data.Count == 0)
            {
                return(false);
            }

            //List<string> Demo_Data = new List<string>(File.ReadAllLines(data_file));


            MyStrings mlist = null;
            string    kStr  = "";


            Save_FormRecord rec = new Save_FormRecord();

            rec.Clear();
            rec.AddControls(frm);
            for (int i = 0; i < Demo_Data.Count; i++)
            {
                try
                {
                    kStr  = MyStrings.RemoveAllSpaces(Demo_Data[i].Trim());
                    mlist = new MyStrings(kStr, '=');
                    if (kStr.Contains("---"))
                    {
                        continue;
                    }
                    //if (i >= 163)
                    //    mlist = new MyStrings(kStr, '=');

                    if (mlist.Count == 2)
                    {
                        try
                        {
                            Control c = rec.Controls[mlist.StringList[0]] as Control;
                            if (c != null)
                            {
                                //if (c.Name.StartsWith("txt"))
                                //    c.Text = mlist.StringList[1];
                                if (c.Name.StartsWith("cmb"))
                                {
                                    //ComboBox cmb = (c as ComboBox);
                                    (c as ComboBox).SelectedItem = mlist.StringList[1];
                                }
                                else if (c.Name.StartsWith("dgv"))
                                {
                                    DataGridView dgv = c as DataGridView;
                                    int          row = mlist.GetInt(1);
                                    dgv.Rows.Clear();

                                    if (dgv.AllowUserToAddRows)
                                    {
                                        row--;
                                    }
                                    for (int j = 0; j < row; j++)
                                    {
                                        i++;
                                        kStr  = MyStrings.RemoveAllSpaces(Demo_Data[i].Trim());
                                        mlist = new MyStrings(kStr, '$');
                                        dgv.Rows.Add(mlist.StringList.ToArray());
                                    }
                                }
                                else if (c.Name.StartsWith("txt"))
                                {
                                    TextBox txt = c as TextBox;
                                    int     row = mlist.GetInt(1);
                                    txt.Text = "";
                                    List <string> ln = new List <string>();

                                    for (int j = 0; j < row; j++)
                                    {
                                        i++;
                                        ln.Add(Demo_Data[i]);
                                    }
                                    txt.Lines = ln.ToArray();
                                }
                            }
                        }
                        catch (Exception ex) { }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("ERROR : " + kStr);
                }
                finally
                {
                    //if (iApp != null) iApp.Progress_OFF();
                }
            }
            return(true);
        }
Exemple #2
0
        public static void Read_All_Data(object frm, string User_Input_Data, bool IsFile)
        {
            //string User_Input_Data = Path.Combine(folder_path, "ASTRA_Data_Input.txt");

            string data_file = User_Input_Data;

            if (!File.Exists(data_file))
            {
                return;
            }


            List <string> file_content = new List <string>(File.ReadAllLines(data_file));

            bool IsRun_ProgressBar = file_content.Count > 9999;



            MyStrings mlist = null;
            string    kStr  = "";


            Save_FormRecord rec = new Save_FormRecord();

            rec.Clear();
            rec.AddControls(frm);
            if (IsRun_ProgressBar)
            {
                //    if (iApp != null)
                //        iApp.Progress_ON("Reading Previous Data...");
            }
            for (int i = 0; i < file_content.Count; i++)
            {
                try
                {
                    kStr = MyStrings.RemoveAllSpaces(file_content[i].Trim());
                    if (i == 0)
                    {
                        mlist = new MyStrings(kStr, ':');

                        if (mlist.Count == 3)
                        {
                            //if (mlist[2].Trim() == eDesignStandard.IndianStandard.ToString())
                            //{
                            //    iApp.DesignStandard = eDesignStandard.IndianStandard;
                            //    iApp.LiveLoads = new LiveLoadCollections(iApp.LL_TXT_Path);
                            //}
                            //if (mlist[2].Trim() == eDesignStandard.BritishStandard.ToString())
                            //{
                            //    iApp.DesignStandard = eDesignStandard.BritishStandard;
                            //    iApp.LiveLoads = new LiveLoadCollections(iApp.LL_TXT_Path);
                            //}
                            continue;
                        }
                    }

                    mlist = new MyStrings(kStr, '=');
                    if (kStr.Contains("---"))
                    {
                        continue;
                    }
                    //if (i >= 163)
                    //    mlist = new MyStrings(kStr, '=');

                    if (mlist.Count == 2)
                    {
                        try
                        {
                            Control c = rec.Controls[mlist.StringList[0]] as Control;
                            if (c != null)
                            {
                                //if (c.Name.StartsWith("txt"))
                                //    c.Text = mlist.StringList[1];
                                if (c.Name.StartsWith("cmb"))
                                {
                                    ComboBox cmb = (c as ComboBox);

                                    int row = mlist.GetInt(1);
                                    cmb.Items.Clear();
                                    string sel_text = "";
                                    for (int j = 0; j < row; j++)
                                    {
                                        i++;
                                        if (j == 0)
                                        {
                                            sel_text = file_content[i];
                                            i++;
                                        }
                                        cmb.Items.Add(file_content[i]);
                                    }
                                    //cmb.SelectedItem = mlist.StringList[1];
                                    cmb.SelectedIndex = MyStrings.StringToInt(sel_text, -1);
                                }
                                else if (c.Name.StartsWith("dgv"))
                                {
                                    DataGridView dgv = c as DataGridView;
                                    int          row = mlist.GetInt(1);
                                    dgv.Rows.Clear();
                                    for (int j = 0; j < row; j++)
                                    {
                                        i++;
                                        kStr  = MyStrings.RemoveAllSpaces(file_content[i].Trim());
                                        mlist = new MyStrings(kStr, '$');
                                        dgv.Rows.Add(mlist.StringList.ToArray());


                                        //kStr = dgv[2, dgv.Rows.Count - 1].Value.ToString(); ;
                                    }
                                }
                                else if (c.Name.StartsWith("txt"))
                                {
                                    TextBox txt = c as TextBox;
                                    int     row = mlist.GetInt(1);
                                    txt.Text = "";
                                    List <string> ln = new List <string>();

                                    for (int j = 0; j < row; j++)
                                    {
                                        i++;
                                        ln.Add(file_content[i]);
                                    }
                                    txt.Lines = ln.ToArray();
                                }
                                else if (c.Name.StartsWith("rtb"))
                                {
                                    RichTextBox txt = c as RichTextBox;
                                    int         row = mlist.GetInt(1);
                                    txt.Text = "";
                                    List <string> ln = new List <string>();

                                    for (int j = 0; j < row; j++)
                                    {
                                        i++;
                                        ln.Add(file_content[i]);
                                    }
                                    txt.Lines = ln.ToArray();
                                }
                                else if (c.Name.StartsWith("rbtn"))
                                {
                                    //ComboBox cmb = (c as ComboBox);
                                    (c as RadioButton).Checked = mlist.StringList[1] == "true";
                                }
                                else if (c.Name.StartsWith("chk"))
                                {
                                    //ComboBox cmb = (c as ComboBox);
                                    (c as CheckBox).Checked = mlist.StringList[1] == "true";
                                }
                            }
                        }
                        catch (Exception ex) { }
                    }
                    if (IsRun_ProgressBar)
                    {
                        //if (iApp != null)
                        //{
                        //    iApp.SetProgressValue(i, file_content.Count);
                        //    //Chiranjit [2013 05 15]
                        //    if (iApp.Is_Progress_Cancel) break;
                        //}
                    }
                }
                catch (Exception ex)
                {
                    //MessageBox.Show("ERROR : " + kStr);
                }
                finally
                {
                    if (IsRun_ProgressBar)
                    {
                        //if (iApp != null) iApp.Progress_OFF();
                    }
                }
            }
        }
Exemple #3
0
        public static void DrawHrdrographFromDataFile(string data_file, vdDocument vdDoc)
        {
            List <HydroData> list_hydro_coll = new List <HydroData>();
            MyStrings        mlist           = null;
            List <string>    file_content    = new List <string>(File.ReadAllLines(data_file));
            string           kStr            = "";
            HydroData        hdr             = null;
            vdMText          mtext           = null;
            vdPolyline       pl   = null;
            vdCircle         cir  = null;
            vdRect           rect = null;

            double min_x, min_y;
            double max_x, max_y;


            min_x = double.MaxValue;
            min_y = min_x;
            max_x = double.MinValue;
            max_y = max_x;
            bool   flag = false;
            double min_foundation_Level = 0.0, Max_Scour_Depth = 0.0;

            foreach (var item in file_content)
            {
                kStr  = item.Replace(",", " ");
                kStr  = item.Replace("=", " ");
                kStr  = MyStrings.RemoveAllSpaces(kStr.ToUpper());
                mlist = new MyStrings(kStr, ' ');

                if (kStr.ToUpper().Contains("DISTANCE"))
                {
                    flag = true;
                }
                if (mlist.StringList[0] == "MIN_FOUNDATION_LEVEL")
                {
                    min_foundation_Level = mlist.GetDouble(1);
                }
                if (mlist.StringList[0] == "MAXIMUM_SCOUR_DEPTH")
                {
                    Max_Scour_Depth = mlist.GetDouble(1);
                }

                //sw.WriteLine("MIN_FOUNDATION_LEVEL = {0}", min_foundation_Level);
                //sw.WriteLine("MAXIMUM_SCOUR_DEPTH = {0}", Max_Scour_Depth);

                if (flag == false)
                {
                    continue;
                }
                try
                {
                    hdr          = new HydroData();
                    hdr.SerialNo = list_hydro_coll.Count + 1;


                    hdr.Distance = mlist.GetDouble(0, -999.0);
                    if (hdr.Distance == -999.0)
                    {
                        throw (new Exception());
                    }

                    hdr.WaterLevel = mlist.GetDouble(1);



                    list_hydro_coll.Add(hdr);

                    if (min_x > hdr.Distance)
                    {
                        min_x = hdr.Distance;
                    }
                    if (min_y > hdr.WaterLevel)
                    {
                        min_y = hdr.WaterLevel;
                    }

                    if (max_x < hdr.Distance)
                    {
                        max_x = hdr.Distance;
                    }
                    if (max_y < hdr.WaterLevel)
                    {
                        max_y = hdr.WaterLevel;
                    }
                }
                catch (Exception ex) { }
            }

            pl = new vdPolyline();
            pl.SetUnRegisterDocument(vdDoc);
            pl.setDocumentDefaults();



            foreach (var item in list_hydro_coll)
            {
                cir = new vdCircle();
                cir.SetUnRegisterDocument(vdDoc);
                cir.setDocumentDefaults();
                cir.Center   = new VectorDraw.Geometry.gPoint(item.Distance, item.WaterLevel);
                cir.Radius   = 0.09;
                cir.PenColor = new vdColor(Color.GreenYellow);
                vdDoc.ActiveLayOut.Entities.AddItem(cir);

                pl.VertexList.Add(cir.Center);
            }
            pl.PenColor = new vdColor(Color.Red);
            vdDoc.ActiveLayOut.Entities.AddItem(pl);


            vdLine ln_min_found = new vdLine();

            ln_min_found.SetUnRegisterDocument(vdDoc);
            ln_min_found.setDocumentDefaults();
            ln_min_found.StartPoint.x = pl.BoundingBox.Left;
            ln_min_found.StartPoint.y = pl.BoundingBox.Bottom - min_foundation_Level;

            ln_min_found.EndPoint.x = pl.BoundingBox.Right;
            ln_min_found.EndPoint.y = pl.BoundingBox.Bottom - min_foundation_Level;
            vdDoc.ActiveLayOut.Entities.AddItem(ln_min_found);


            mtext = new vdMText();
            mtext.SetUnRegisterDocument(vdDoc);
            mtext.setDocumentDefaults();
            mtext.InsertionPoint.x = ln_min_found.StartPoint.x;
            mtext.InsertionPoint.y = ln_min_found.StartPoint.y - 0.2;
            mtext.Height           = 0.3;
            //mtext.Rotation = 90 * Math.PI / 180.0;

            mtext.TextString = "Depth from LBL to minimum Foundation Level = " + min_foundation_Level.ToString("0.0000");
            mtext.PenColor   = new vdColor(Color.Cyan);
            vdDoc.ActiveLayOut.Entities.AddItem(mtext);



            vdLine ln_max_scour = new vdLine();

            ln_max_scour.SetUnRegisterDocument(vdDoc);
            ln_max_scour.setDocumentDefaults();
            ln_max_scour.StartPoint.x = pl.BoundingBox.Left;
            ln_max_scour.StartPoint.y = pl.BoundingBox.Bottom - Max_Scour_Depth;

            ln_max_scour.EndPoint.x = pl.BoundingBox.Right;
            ln_max_scour.EndPoint.y = pl.BoundingBox.Bottom - Max_Scour_Depth;
            vdDoc.ActiveLayOut.Entities.AddItem(ln_max_scour);



            mtext = new vdMText();
            mtext.SetUnRegisterDocument(vdDoc);
            mtext.setDocumentDefaults();
            mtext.InsertionPoint    = ln_max_scour.StartPoint;
            mtext.InsertionPoint.y -= 0.2;
            mtext.Height            = 0.3;
            //mtext.Rotation = 90 * Math.PI / 180.0;

            mtext.TextString = "Maximum Scour Depth obtained = " + Max_Scour_Depth.ToString("0.0000");
            mtext.PenColor   = new vdColor(Color.Cyan);
            vdDoc.ActiveLayOut.Entities.AddItem(mtext);

            //Maximum Scour Depth adopted =

            //Depth from LBL to minimum Foundation Level


            //vdRect rect = null;
            rect = new vdRect();
            rect.SetUnRegisterDocument(vdDoc);
            rect.setDocumentDefaults();

            rect.InsertionPoint.x = pl.BoundingBox.Left - 2;
            if (min_foundation_Level > Max_Scour_Depth)
            {
                rect.InsertionPoint.y = pl.BoundingBox.Bottom - 2 - min_foundation_Level;
            }
            else
            {
                rect.InsertionPoint.y = pl.BoundingBox.Bottom - 2 - Max_Scour_Depth;
            }

            rect.Width = pl.BoundingBox.Width + 4;
            //rect.Height = -pl.BoundingBox.Height;
            rect.Height = -2;

            vdDoc.ActiveLayOut.Entities.AddItem(rect);


            vdLine ln = new vdLine();

            ln.SetUnRegisterDocument(vdDoc);
            ln.setDocumentDefaults();
            ln.StartPoint.x = rect.BoundingBox.Left;
            ln.StartPoint.y = rect.BoundingBox.Bottom + 1;
            ln.EndPoint.x   = rect.BoundingBox.Right;
            ln.EndPoint.y   = rect.BoundingBox.Bottom + 1;

            vdDoc.ActiveLayOut.Entities.AddItem(ln);

            foreach (var item in list_hydro_coll)
            {
                mtext = new vdMText();
                mtext.SetUnRegisterDocument(vdDoc);
                mtext.setDocumentDefaults();
                mtext.InsertionPoint.x = item.Distance;
                mtext.InsertionPoint.y = ln.BoundingBox.Bottom + 0.2;
                mtext.Height           = 0.1;
                mtext.Rotation         = 90 * Math.PI / 180.0;

                mtext.TextString = item.WaterLevel.ToString("0.0000");
                mtext.PenColor   = new vdColor(Color.Cyan);
                vdDoc.ActiveLayOut.Entities.AddItem(mtext);


                mtext = new vdMText();
                mtext.SetUnRegisterDocument(vdDoc);
                mtext.setDocumentDefaults();
                mtext.InsertionPoint.x = item.Distance;
                mtext.InsertionPoint.y = rect.BoundingBox.Bottom + 0.2;
                mtext.Height           = 0.1;
                mtext.Rotation         = 90 * Math.PI / 180.0;

                mtext.TextString = item.Distance.ToString("0.0000");
                mtext.PenColor   = new vdColor(Color.LightGreen);
                vdDoc.ActiveLayOut.Entities.AddItem(mtext);
            }


            mtext = new vdMText();
            mtext.SetUnRegisterDocument(vdDoc);
            mtext.setDocumentDefaults();
            mtext.InsertionPoint.x = rect.BoundingBox.Left + 0.2;
            mtext.InsertionPoint.y = rect.BoundingBox.Top + 0.2;
            mtext.Height           = 0.11;
            //mtext.Rotation = 90 * Math.PI / 180.0;

            mtext.TextString = "DATUM = " + rect.BoundingBox.Top.ToString("0.00");
            vdDoc.ActiveLayOut.Entities.AddItem(mtext);

            mtext = new vdMText();
            mtext.SetUnRegisterDocument(vdDoc);
            mtext.setDocumentDefaults();
            mtext.InsertionPoint.x = rect.BoundingBox.Left + 0.2;
            mtext.InsertionPoint.y = ln.BoundingBox.Bottom + 0.5;
            mtext.Height           = 0.1;
            //mtext.Rotation = 90 * Math.PI / 180.0;

            mtext.TextString = "RIVER BED LEVEL (m)";
            mtext.PenColor   = new vdColor(Color.Cyan);
            vdDoc.ActiveLayOut.Entities.AddItem(mtext);


            mtext = new vdMText();
            mtext.SetUnRegisterDocument(vdDoc);
            mtext.setDocumentDefaults();
            mtext.InsertionPoint.x = rect.BoundingBox.Left + 0.2;
            mtext.InsertionPoint.y = rect.BoundingBox.Bottom + 0.5;
            mtext.Height           = 0.1;
            //mtext.Rotation = 90 * Math.PI / 180.0;

            mtext.TextString = "DISTANCE (m)";
            mtext.PenColor   = new vdColor(Color.LightGreen);
            vdDoc.ActiveLayOut.Entities.AddItem(mtext);


            ln = new vdLine();
            ln.SetUnRegisterDocument(vdDoc);
            ln.setDocumentDefaults();
            ln.StartPoint.x = rect.BoundingBox.Left + 1.8;
            ln.StartPoint.y = rect.BoundingBox.Bottom;
            ln.EndPoint.x   = rect.BoundingBox.Left + 1.8;
            ln.EndPoint.y   = rect.BoundingBox.Top;


            vdDoc.ActiveLayOut.Entities.AddItem(ln);

            vdRect over_box = new vdRect();

            over_box.SetUnRegisterDocument(vdDoc);
            over_box.setDocumentDefaults();

            over_box.InsertionPoint.x = rect.BoundingBox.Left - 2;
            over_box.InsertionPoint.y = rect.BoundingBox.Bottom - 1;

            over_box.Width  = rect.BoundingBox.Width + 4;
            over_box.Height = (pl.BoundingBox.Top - rect.BoundingBox.Bottom) + 2;

            vdDoc.ActiveLayOut.Entities.AddItem(over_box);

            VectorDraw.Professional.ActionUtilities.vdCommandAction.View3D_VTop(vdDoc);
            vdDoc.Redraw(true);
        }
Exemple #4
0
        private void SET_NodalDisplacement(string text)
        {
            NodeDisplacement nd    = new NodeDisplacement();
            MyStrings        mList = new MyStrings(MyStrings.RemoveAllSpaces(text), ' ');

            int indx = 0;

            if (mList.Count == 8)
            {
                indx           = 0;
                nd.Node.NodeNo = mList.GetInt(indx); indx++;
                lastNodeNo     = nd.Node.NodeNo;

                nd.LoadCase = mList.GetInt(indx); indx++;
                maxLoadCase = nd.LoadCase;

                nd.Tx = mList.GetDouble(indx); indx++;
                nd.Ty = mList.GetDouble(indx); indx++;
                nd.Tz = mList.GetDouble(indx); indx++;
                nd.Rx = mList.GetDouble(indx); indx++;
                nd.Ry = mList.GetDouble(indx); indx++;
                nd.Rz = mList.GetDouble(indx); indx++;
            }
            else if (mList.Count == 7)
            {
                indx           = 0;
                nd.Node.NodeNo = lastNodeNo;
                nd.LoadCase    = mList.GetInt(indx); indx++;
                maxLoadCase    = nd.LoadCase;

                nd.Tx = mList.GetDouble(indx); indx++;
                nd.Ty = mList.GetDouble(indx); indx++;
                nd.Tz = mList.GetDouble(indx); indx++;
                nd.Rx = mList.GetDouble(indx); indx++;
                nd.Ry = mList.GetDouble(indx); indx++;
                nd.Rz = mList.GetDouble(indx); indx++;
            }

            #region Calculate Proportionate
            /**/
            double x, y, z, prp, dif;

            x = y = z = prp = dif = 0.0;

            if (nd.Tx < nd.Ty && nd.Tx < nd.Tz)
            {
                x = nd.Tx;
                if (x < 1.0d)
                {
                    dif = 1.0d - x;
                    prp = x / dif;
                    x   = 1.0d;
                    y   = y * prp;
                    z   = z * prp;

                    //nd.Tx = x;
                    //nd.Ty += y;
                    //nd.Tz += z;
                }
            }
            else if (nd.Ty < nd.Tx && nd.Ty < nd.Tz)
            {
                y = nd.Ty;
                if (y < 1.0)
                {
                    dif = 1.0d - y;
                    prp = y / dif;
                    y   = 1.0d;
                    x   = x * prp;
                    z   = z * prp;


                    //nd.Tx += x;
                    //nd.Ty = y;
                    //nd.Tz += z;
                }
            }
            else if (nd.Tz < nd.Tx && nd.Tz < nd.Ty)
            {
                z = nd.Tz;
                if (z < 1.0d)
                {
                    dif = 1.0d - z;
                    prp = z / dif;
                    z   = 1.0d;
                    y   = y * prp;
                    x   = x * prp;

                    //nd.Tx += x;
                    //nd.Ty += y;
                    //nd.Tz = z;
                }
            }

            /*
             * if (nd.Tx > 0.0)
             * {
             *  nd.Tx += x;
             * }
             * else
             * {
             *  nd.Tx -= x;
             * }
             *
             * if (nd.Ty > 0.0)
             * {
             *  nd.Ty += y;
             * }
             * else
             * {
             *  nd.Tx -= y;
             * }
             *
             * if (nd.Tz > 0.0)
             * {
             *  nd.Tz += z;
             * }
             * else
             * {
             *  nd.Tz -= z;
             * }
             * /**/
            double factor = 1d;

            nd.Tx = nd.Tx * factor;
            nd.Ty = nd.Ty * factor;
            nd.Tz = nd.Tz * factor;
            #endregion

            //Chiranjit [2014 08 14]
            if (nd.Ty > 0)
            {
                nd.Ty = nd.Ty * -1;
            }



            ndispCol.Add(nd);
        }
Exemple #5
0
        public void SetElementProperty(string propData)
        {
            //ELEMENT PROP
            //1 2 3 TH 0.5

            //ELEMENT PROPERTIES
            //1 2 3 TO 334 335 336 TH 0.07 DEN 0.0 Exx 3.00934e6  Exy 531061  Exg 0.0  Eyy 3.00934e6  Eyg 0.0  Gxy 1.23913e6

            int    thIndex = -1;
            int    indx = -1;
            double th, den;

            th = den = 0.0d;

            string temp = propData.TrimStart().TrimEnd().Trim().ToUpper().Replace("THICKNESS", "TH");

            MyStrings mLIst = new MyStrings(temp, ' ');

            thIndex = mLIst.StringList.IndexOf("TH");
            if (thIndex != -1)
            {
                th = mLIst.GetDouble(thIndex + 1);
            }
            indx = mLIst.StringList.IndexOf("DEN");
            if (indx != -1)
            {
                den = mLIst.GetDouble(indx + 1);
                mLIst.StringList.RemoveRange(indx + 2, (mLIst.StringList.Count - (indx + 2)));
            }

            //1 2 3 TO 334 335 336 TH 0.07 DEN 0.0 Exx 3.00934e6  Exy 531061  Exg 0.0  Eyy 3.00934e6  Eyg 0.0  Gxy 1.23913e6

            int toIndex = -1;

            if (mLIst.StringList.Contains("TO"))
            {
                while (mLIst.StringList.Contains("TO"))
                {
                    toIndex = mLIst.StringList.IndexOf("TO");
                    if (toIndex > 1)
                    {
                        for (int i = 0; i < (toIndex - 1); i++)
                        {
                            indx = IndexOf(mLIst.GetInt(i));
                            if (indx != -1)
                            {
                                this[indx].ThickNess = th.ToString();
                                this[indx].Density   = den.ToString();
                            }
                        }
                        mLIst.StringList.RemoveRange(0, toIndex - 2);
                    }
                    toIndex = mLIst.StringList.IndexOf("TO");
                    if (toIndex != -1)
                    {
                        for (int i = mLIst.GetInt(toIndex - 1); i <= mLIst.GetInt(toIndex + 1); i++)
                        {
                            this[IndexOf(i)].ThickNess = th.ToString();
                            this[IndexOf(i)].Density   = den.ToString();
                        }
                        mLIst.StringList.RemoveRange(0, toIndex + 2);
                    }
                }
            }
            //else
            //{
            thIndex = mLIst.StringList.IndexOf("TH");

            for (int i = 0; i < thIndex; i++)
            {
                indx = IndexOf(mLIst.GetInt(i));
                if (indx != -1)
                {
                    this[indx].ThickNess = th.ToString();
                    this[indx].Density   = den.ToString();
                }
            }
            //}
        }
Exemple #6
0
            public void Read_File_File(string file_name)
            {
                if (!File.Exists(file_name)) return;

                Table = new Hashtable();
                #region SAMPLE
                //START GROUP DEFINITION
                //_L0L1         1          6          7         12
                //_L1L2         2          5          8         11
                //_L2L3         3          4          9         10
                //_U1U2        35         38         39         42
                //_U2U3        36         37         40         41
                //_L1U1        13         17         18         22
                //_L2U2        14         16         19         21
                //_L3U3        15         20
                //_ER         23         28         29         34
                //_L2U1        24         27         30         33
                //_L3U2        25         26         31         32
                //_TCS_ST            102         TO        106 
                //_TCS_DIA           107         TO        114 
                //_BCB               115         TO        126 
                //_STRINGER           43         TO         66 
                //_XGIRDER            67         TO        101 
                //END
                //MEMBER PROPERTY
                //_L0L1      	PRI	AX	0.024	IX	0.00001	IY	0.000741	IZ	0.001
                //_L1L2      	PRI	AX	0.024	IX	0.00001	IY	0.000741	IZ	0.001
                //_L2L3      	PRI	AX	0.030	IX	0.00001	IY	0.000946	IZ	0.001
                //_U1U2      	PRI	AX	0.027	IX	0.00001	IY	0.000807	IZ	0.000693
                //_U2U3      	PRI	AX	0.033	IX	0.00001	IY	0.000864	IZ	0.000922
                //_L1U1      	PRI	AX	0.006	IX	0.00001	IY	0.000182	IZ	0.000036
                //_L2U2      	PRI	AX	0.013	IX	0.00001	IY	0.000399	IZ	0.000302
                //_L3U3      	PRI	AX	0.009	IX	0.00001	IY	0.000290	IZ	0.000127
                //_ER           	PRI	AX	0.022	IX	0.00001	IY	0.000666	IZ	0.000579
                //_L2U1      	PRI	AX	0.019	IX	0.00001	IY	0.000621	IZ	0.000356
                //_L3U2      	PRI	AX	0.014	IX	0.00001	IY	0.000474	IZ	0.000149
                //_TCS_ST	        PRI	AX	0.006	IX	0.00001	IY	0.000027	IZ	0.000225
                //_TCS_DIA	PRI	AX	0.006	IX	0.00001	IY	0.000027	IZ	0.000225
                //_BCB	        PRI	AX	0.002	IX	0.00001	IY	0.000001	IZ	0.000001
                //_STRINGER	PRI	AX	0.048	IX	0.00001	IY	0.008	        IZ	0.002
                //_XGIRDER	PRI	AX	0.059	IX	0.00001	IY	0.009	        IZ	0.005
                //MEMBER TRUSS
                //_L0L1
                //MEMBER TRUSS
                //_L1L2
                //MEMBER TRUSS
                //_L2L3
                //MEMBER TRUSS
                //_U1U2
                //MEMBER TRUSS
                //_U2U3
                //MEMBER TRUSS
                //_L1U1
                //MEMBER TRUSS
                //_L2U2
                //MEMBER TRUSS
                //_L3U3
                //MEMBER TRUSS
                //_ER
                //MEMBER TRUSS
                //_L2U1
                //MEMBER TRUSS
                //_L3U2
                //MEMBER TRUSS
                //_TCS_ST
                //MEMBER TRUSS
                //_TCS_DIA
                //MEMBER TRUSS
                //_BCB
                #endregion
                List<string> list = new List<string>(File.ReadAllLines(file_name));

                bool flag1 = false;
                bool flag2 = false;
                MyStrings mlist = null;
                string kStr = "";
                _MemberGroup mgr = new _MemberGroup();
                for (int i = 0; i < list.Count; i++)
                {
                    kStr = list[i].Trim().TrimEnd().TrimStart().ToUpper();
                    kStr = MyStrings.RemoveAllSpaces(kStr);

                    mlist = new MyStrings(MyStrings.RemoveAllSpaces(kStr), ' ');

                    if (kStr.StartsWith("START GROUP"))
                    {
                        flag1 = true;
                        continue;
                    }
                    if (kStr.StartsWith("MEMBER PROPERTY"))
                    {
                        flag2 = true;
                        flag1 = false;
                        continue;
                    }
                    if (kStr.StartsWith("END") && !kStr.StartsWith("END_RA"))
                    {
                        flag1 = false;
                        continue;
                    }
                    else if (kStr.StartsWith("FINISH"))
                    {
                        break;
                    }

                    if (flag1)
                    {
                        try
                        {
                            mgr = Table[mlist.StringList[0]] as _MemberGroup;
                            if (mgr == null)
                            {
                                mgr = new _MemberGroup();
                                mgr.Name = mlist.StringList[0];
                                mgr.MemberNosText = mlist.GetString(1);
                                mgr.SetMemNos();
                                Table.Add(mgr.Name, mgr);
                                Add(mgr);
                            }
                        }
                        catch (Exception ex)
                        {
                        }
                    }

                    if (flag2)
                    {

                        try
                        {

                            mgr = Table[mlist.StringList[0]] as _MemberGroup;

                            if (mgr != null)
                            {
                                if (mlist.Count == 1)
                                {
                                    kStr = list[i - 1];
                                    kStr = MyStrings.RemoveAllSpaces(kStr);
                                    mlist = new MyStrings(kStr, ' ');

                                    if (mlist.Count > 1)
                                    {
                                        if (mlist.StringList[1].StartsWith("TRUSS"))
                                        {
                                            mgr.GroupType = MembType.TRUSS;
                                        }
                                        else if (mlist.StringList[1].StartsWith("BEAM"))
                                        {
                                            mgr.GroupType = MembType.BEAM;
                                        }
                                        else if (mlist.StringList[1].StartsWith("CABLE"))
                                        {
                                            mgr.GroupType = MembType.CABLE;
                                        }
                                    }
                                    continue;
                                }
                                else
                                {
                                    for (int j = 1; j < mlist.Count; j++)
                                    {
                                        if (mlist.StringList[j].StartsWith("PR"))
                                            mgr.Properties.PR = mlist.StringList[j];
                                        else if (mlist.StringList[j].StartsWith("IX"))
                                            mgr.Properties.IX = mlist.GetDouble(j + 1);
                                        else if (mlist.StringList[j].StartsWith("IY"))
                                            mgr.Properties.IY = mlist.GetDouble(j + 1);
                                        else if (mlist.StringList[j].StartsWith("IZ"))
                                            mgr.Properties.IZ = mlist.GetDouble(j + 1);
                                        else if (mlist.StringList[j].StartsWith("AX"))
                                            mgr.Properties.Area = mlist.GetDouble(j + 1);

                                    }
                                }
                            }
                        }
                        catch (Exception ex) { }
                    }

                }
                //this
            }