public void AddAST(string s) { //N018 UNIT 1.000 1.000 KIP FT KIP FT ELTYPE=6, Element#, Node1#, Node2#, Node3#, Node4# // 0 [1] [2] [3] [4] [5][6] [7] [8] [9] [10] [11] //N018 1 5 6 8 7 0 1 0.500 -1.000 0.00 0.00 //N018 2 3 4 8 7 0 1 0.500 -1.000 0.00 0.00 //N018 3 7 8 12 11 0 1 0.500 0.000 0.00 0.00 string temp = s.Trim().TrimStart().TrimEnd().Replace('\t', ' '); while (temp.Contains(" ")) { temp = temp.Replace(" ", " "); } MyStrings mList = new MyStrings(temp, ' '); Element elmt = new Element(); elmt.ElementNo = mList.GetInt(1); elmt.Node1.NodeNo = mList.GetInt(2); elmt.Node2.NodeNo = mList.GetInt(3); elmt.Node3.NodeNo = mList.GetInt(4); elmt.Node4.NodeNo = mList.GetInt(5); elmt.ThickNess = mList.StringList[8]; //elmt. Add(elmt); }
public void AddToList(string str, int SpanNo) { str = str.Replace('\t', ' '); while (str.Contains(" ")) { str = str.Replace(" ", " "); } MyStrings mList = new MyStrings(str, ' '); /* * * SPAN NO. 1 * SECTION NO. DISTANCE(m) SHEAR MOMENT * 1 0.00 131.10 0.00 * 2 0.60 100.50 69.48 * 3 1.20 69.90 120.60 * * */ try { BeamAnalysis beamAna = new BeamAnalysis(); beamAna.SpanNo = SpanNo; beamAna.SectionNo = mList.GetInt(0); beamAna.Distance = mList.GetDouble(1); beamAna.Shear = mList.GetDouble(2); beamAna.Moment = mList.GetDouble(3); Add(beamAna); } catch (Exception exx) { } }
public void ReadFromFile(string fileName) { if (!File.Exists(fileName)) { return; } string kStr = ""; int SpanNo = 0; bool work = false; StreamReader sr = new StreamReader(new FileStream(fileName, FileMode.Open, FileAccess.Read)); try { while (sr.EndOfStream == false) { kStr = sr.ReadLine().Trim().TrimEnd().TrimStart(); if (kStr.Contains("SPAN NO.")) { MyStrings mL = new MyStrings(kStr, ' '); try { SpanNo = mL.GetInt(2); work = true; } catch (Exception exx) { } } if (work) { AddToList(kStr, SpanNo); } } } catch (Exception ex) { } finally { sr.Close(); } }
public void AddAST(string itemData) { //N008 ELTYPE=1, TRUSS_MEMB # //N008 1 14 //N008 1 15 //N008 1 16 //N008 1 17 string temp = itemData.TrimEnd().Trim().TrimStart().Replace('\t', ' '); while (temp.Contains(" ")) { temp = temp.Replace(" ", " "); } MyStrings mList = new MyStrings(temp, ' '); int indx = IndexOf(mList.GetInt(2)); if (indx != -1) { list[indx].MemberType = MembType.TRUSS; } }
public bool ReadTypeDetails(string fileName, int typeNo) { bool success = false; if (!File.Exists(fileName)) { return(false); } List <string> lstContent = new List <string>(File.ReadAllLines(fileName)); string kStr = ""; MyStrings mList = null; for (int i = 0; i < lstContent.Count; i++) { kStr = MyStrings.RemoveAllSpaces(lstContent[i]).ToUpper(); if (kStr.StartsWith("TYPE")) { kStr = kStr.Replace("TYPE", " "); mList = new MyStrings(MyStrings.RemoveAllSpaces(kStr), ' '); if (typeNo == mList.GetInt(0)) { MovingWheel mw = new MovingWheel(); i++; mw.Load = lstContent[i]; i++; mw.Distance = lstContent[i]; i++; mw.Width = MyStrings.StringToDouble(lstContent[i], 0.0); Add(mw); success = true; break; } } } return(success); }
public void SetConstants(string s) { //CONSTANTS //E 3150 ALL //DEN 0.000383 ALL //3 CONSTANTS //E 200 1 TO 47 //DEN 0.078 1 TO 47 int indx = -1; string temp = s.Replace('\t', ' ').Trim().TrimEnd().TrimStart().ToUpper(); while (temp.Contains(" ")) { temp = temp.Replace(" ", " "); } MyStrings mList = new MyStrings(temp, ' '); if (list.Count == 0) { MemberProperty mp = null; for (int i = 0; i < AnalysisData.Members.Count; i++) { mp = new MemberProperty(); mp.Member.MemberNo = AnalysisData.Members[i].MemberNo; list.Add(mp); } } if (mList.StringList[0] == "E") { if (mList.StringList.Contains("ALL")) { for (int i = 0; i < list.Count; i++) { list[i].E = mList.StringList[1]; } } else if (mList.StringList.Contains("TO")) { indx = mList.StringList.IndexOf("TO"); //for (int i = mList.GetInt(indx - 1); i <= mList.GetInt(indx + 1); i++) //{ // list[i].E = mList.GetDouble(1); //} for (int i = mList.GetInt(indx - 1); i <= mList.GetInt(indx + 1); i++) { this[IndexOf(i)].E = mList.StringList[1]; } } else { mList.StringList.RemoveAt(0); //mList.StringList.RemoveAt(0); double val = mList.GetDouble(0); for (int i = 1; i < mList.Count; i++) { this[IndexOf(mList.GetInt(i))].E = mList.StringList[0]; } } } if (mList.StringList[0].StartsWith("DEN")) { if (mList.StringList.Contains("ALL")) { for (int i = 0; i < list.Count; i++) { list[i].DEN = mList.StringList[1]; } } else if (mList.StringList.Contains("TO")) { indx = mList.StringList.IndexOf("TO"); //for (int i = mList.GetInt(indx - 1); i <= mList.GetInt(indx + 1); i++) //{ // list[i].DEN = mList.StringList[1]; //} for (int i = mList.GetInt(indx - 1); i <= mList.GetInt(indx + 1); i++) { this[IndexOf(i)].DEN = mList.StringList[1]; //list[i].PR = mList.StringList[1]; } } else { mList.StringList.RemoveAt(0); //mList.StringList.RemoveAt(0); //double val = mList.GetDouble(0); for (int i = 1; i < mList.Count; i++) { this[IndexOf(mList.GetInt(i))].DEN = mList.StringList[0]; } } } if (mList.StringList[0] == "PR" || mList.StringList[0] == "POISSON") { if (mList.StringList.Contains("ALL")) { for (int i = 0; i < list.Count; i++) { list[i].PR = mList.StringList[1]; } } else if (mList.StringList.Contains("TO")) { indx = mList.StringList.IndexOf("TO"); for (int i = mList.GetInt(indx - 1); i <= mList.GetInt(indx + 1); i++) { this[IndexOf(i)].PR = mList.StringList[1]; //list[i].PR = mList.StringList[1]; } } else { mList.StringList.RemoveAt(0); for (int i = 1; i < mList.Count; i++) { this[IndexOf(mList.GetInt(i))].PR = mList.StringList[0]; } } } }
public void AddTxt_2014_04_07(string s) { //1 2 PRISMATIC YD 12 ZD 12 IZ 509 IY 509 IX 1018 //3 TO 10 PR YD 12 ZD 12 IZ 864 IY 864 IX 1279 //11 TO 21 PR YD 21 ZD 16 IZ 5788 IY 2953 IX 6497 //1 TO 993 AX 0.54 IX 0.07390 IY 0.00911 IZ 0.06480 //1 3 4 A 28.11 IX 1509.4 IY 188.6 ; 2 A 21.67 IX 839.1 IY 94.8 //5 6 7 A 43.24 IX 3920.5 IY 448.6 ; 8 TO 13 A 36.71 IX 2624.5 IY 328.8 //14 TO 23 A 3.07 IX 4.5 //1 2 3 13 14 15 16 18 94 95 100 TO 105 116 TO 129 165 167 172 173 174 184 TO 186 AX 0.54 IX 0.07390 IY 0.00911 IZ 0.06480 string temp = s.ToUpper().Trim().TrimEnd().TrimStart().Replace("PRISMATIC", "PR"); List <string> lstStr = new List <string>(temp.Split(new char[] { ' ' })); MyStrings mList = new MyStrings(lstStr); double area, yd, zd, ix, iy, iz; int indx = -1; List <int> mems = MyStrings.Get_Array_Intiger(temp); area = yd = zd = ix = iy = iz = 0.0d; int toIndex = lstStr.IndexOf("TO"); if (lstStr.Contains("YD")) { indx = lstStr.IndexOf("YD"); yd = mList.GetDouble(indx + 1); } if (lstStr.Contains("ZD")) { indx = lstStr.IndexOf("ZD"); zd = mList.GetDouble(indx + 1); } if (lstStr.Contains("IX")) { indx = lstStr.IndexOf("IX"); ix = mList.GetDouble(indx + 1); } if (lstStr.Contains("IY")) { indx = lstStr.IndexOf("IY"); iy = mList.GetDouble(indx + 1); } if (lstStr.Contains("IZ")) { indx = lstStr.IndexOf("IZ"); iz = mList.GetDouble(indx + 1); } if (lstStr.Contains("AX")) { indx = lstStr.IndexOf("AX"); area = mList.GetDouble(indx + 1); } if (lstStr.Contains("A")) { indx = lstStr.IndexOf("A"); area = mList.GetDouble(indx + 1); } try { //1 2 3 13 14 15 16 18 94 95 100 TO 105 116 TO 129 165 167 172 173 174 184 TO 186 AX 0.54 IX 0.07390 IY 0.00911 IZ 0.06480 if (lstStr.Contains("TO")) { MyStrings tempLst = new MyStrings(temp, ' '); toIndex = tempLst.StringList.IndexOf("TO", 0); while (tempLst.StringList.Contains("TO")) { toIndex = tempLst.StringList.IndexOf("TO", 0); if (toIndex > 1) { for (int i = 0; i < (toIndex - 1); i++) { MemberProperty mp = new MemberProperty(); mp.Member.MemberNo = tempLst.GetInt(i); mp.YD = yd; mp.ZD = zd; mp.IX = ix; mp.IY = iy; mp.IZ = iz; mp.Area = area; Add(mp); } tempLst.StringList.RemoveRange(0, toIndex - 1); } toIndex = tempLst.StringList.IndexOf("TO", 0); for (int i = tempLst.GetInt(toIndex - 1); i <= tempLst.GetInt(toIndex + 1); i++) { MemberProperty mp = new MemberProperty(); mp.Member.MemberNo = i; mp.YD = yd; mp.ZD = zd; mp.IX = ix; mp.IY = iy; mp.IZ = iz; mp.Area = area; Add(mp); } tempLst.StringList.RemoveRange(0, toIndex + 2); } return; } } catch (Exception exx) { } //if (lstStr.Contains("TO")) //{ // toIndex = lstStr.IndexOf("TO"); // for (int i = mList.GetInt(toIndex - 1); i <= mList.GetInt(toIndex + 1); i++) // { // MemberProperty mp = new MemberProperty(); // mp.Member.MemberNo = i; // mp.YD = yd; // mp.ZD = zd; // mp.IX = ix; // mp.IY = iy; // mp.IZ = iz; // mp.Area = area; // Add(mp); // } //} //else //{ //indx = lstStr.IndexOf("PR"); if (indx == -1) { indx = lstStr.IndexOf("A"); if (indx == -1) { indx = lstStr.IndexOf("AX"); } } for (int i = 0; i < indx; i++) { MemberProperty mp = new MemberProperty(); mp.Member.MemberNo = mList.GetInt(i); mp.YD = yd; mp.ZD = zd; mp.IX = ix; mp.IY = iy; mp.IZ = iz; mp.Area = area; Add(mp); } //} }
public void AddAST(string s) { // //N003 UNIT 1.000 0.083 KIP FT KIP INCH member#, section_ID#,B, D, Do, Di, area*lfact*lfact, ix*lfact*lfact*lfact*lfact, iy*lfact*lfact*lfact*lfact, iy*lfact*lfact*lfact*lfact //N003 1 1 0 0 0 0 144 1018 509 509 //N003 2 1 0 0 0 0 144 1018 509 509 //N003 element#,section_ID#,B , D, Do, Di, area , ix, iy, iz // 0 1 2 3 4 5 6 7 8 9 10 //N003 1 1 0.000000 0.000000 0.000000 0.000000 144.000000 1018.000000 509.000000 509.000000 //N003 2 1 0.000000 0.000000 0.000000 0.000000 144.000000 1018.000000 509.000000 509.000000 //N004 element#,mat_ID#, emod , pr, mden, wden , alpha, beta //0 1 2 3 4 5 6 7 8 //N004 1 1 3150.000 0.150 0.000383 0.000383 0.000012 0.000000 //N004 2 1 3150.000 0.150 0.000383 0.000383 0.000012 0.000000 //N004 3 1 3150.000 0.150 0.000383 0.000383 0.000012 0.000000 //N004 4 1 3150.000 0.150 0.000383 0.000383 0.000012 0.000000 string temp = s.Trim().TrimEnd().TrimStart().Replace('\t', ' '); while (temp.Contains(" ")) { temp = temp.Replace(" ", " "); } MemberProperty mProp = new MemberProperty(); MyStrings mList = new MyStrings(temp, ' '); if (mList.StringList[0] == "N003") { mProp.Member.MemberNo = mList.GetInt(1); mProp.YD = mList.GetDouble(3); mProp.ZD = mList.GetDouble(4); mProp.Area = mList.GetDouble(7); mProp.IX = mList.GetDouble(8); mProp.IY = mList.GetDouble(9); mProp.IZ = mList.GetDouble(10); Add(mProp); } else if (mList.StringList[0] == "N004") { int indx = IndexOf(mList.GetInt(1)); if (indx != -1) { list[indx].E = mList.StringList[3]; list[indx].PR = mList.StringList[4]; list[indx].DEN = mList.StringList[5]; } else { //mProp = new MemberProperty(); //mProp.Member.MemberNo = mList.GetInt(1); //mProp.Area = mList.GetDouble(7); //mProp.IX = mList.GetDouble(8); //mProp.IY = mList.GetDouble(9); //mProp.IZ = mList.GetDouble(10); } } }
public static List <int> Get_Array_Intiger(string list_text) { //11 12 15 TO 21 43 89 98, 45 43 List <int> list = new List <int>(); string kStr = RemoveAllSpaces(list_text.ToUpper().Trim()); try { kStr = kStr.Replace("T0", "TO"); kStr = kStr.Replace("-", "TO"); kStr = kStr.Replace(",", " "); kStr = RemoveAllSpaces(kStr.ToUpper().Trim()); MyStrings mlist = new MyStrings(MyStrings.RemoveAllSpaces(kStr), ' '); int start = 0; int end = 0; for (int i = 0; i < mlist.Count; i++) { try { if (mlist.StringList[i] != "TO") { start = mlist.GetInt(i); } } catch (Exception exx) { kStr = mlist.GetString(0, i - 1); break; } } mlist = new MyStrings(MyStrings.RemoveAllSpaces(kStr), ' '); for (int i = 0; i < mlist.Count; i++) { try { start = mlist.GetInt(i); if (i < mlist.Count - 1) { if (mlist.StringList[i + 1] == "TO") { //start = mlist.GetInt(i); end = mlist.GetInt(i + 2); for (int j = start; j <= end; j++) { list.Add(j); } i += 2; } else { list.Add(start); } } else { list.Add(start); } } catch (Exception ex) { } } mlist = null; } catch (Exception ex) { } list.Sort(); return(list); }
public bool Read_Type_From_Text_File(string fileName) { // Text File // Example 7 //LOAD GENERATION 191 //TYPE 1 -18.8 0 2.75 XINC 0.2 //TYPE 1 -18.8 0 6.25 XINC 0.2 //TYPE 1 -18.8 0 9.75 XINC 0.2 // AST File //LOAD GENERATION 191 //N012 TYPE 1 -18.8 0 2.75 XINC 0.2 //N012 TYPE 1 -18.8 0 6.25 XINC 0.2 //N012 TYPE 1 -18.8 0 9.75 XINC 0.2 if (!File.Exists(fileName)) { return(false); } bool IsAst = false; if (Path.GetExtension(fileName).ToLower() == ".ast") { IsAst = true; } string ll_txt = Path.GetDirectoryName(fileName); ll_txt = Path.Combine(ll_txt, "LL.FIL"); if (!File.Exists(ll_txt)) { ll_txt = Path.Combine(ll_txt, "LL.TXT"); } List <string> lstContent = new List <string>(File.ReadAllLines(fileName)); bool is_find = false; string kStr = ""; MyStrings mList = null; for (int i = 0; i < lstContent.Count; i++) { kStr = MyStrings.RemoveAllSpaces(lstContent[i]); if (kStr.StartsWith("N012")) { kStr = MyStrings.RemoveAllSpaces(kStr.Replace("N012", "")); } if (kStr.Contains("LOAD GENE")) { is_find = true; list.Clear(); continue; } if (kStr.Contains("FINISH")) { is_find = false; } if (is_find) { try { mList = new MyStrings(kStr, ' '); LoadGeneration lg = new LoadGeneration(); // 0 1 2 3 4 5 6 //TYPE 1 -18.8 0 9.75 XINC 0.2 lg.TypeNo = mList.GetInt(1); lg.X = mList.GetDouble(2); lg.Y = mList.GetDouble(3); lg.Z = mList.GetDouble(4); lg.XINC = mList.GetDouble(6); lg.Moving_Wheel.ReadTypeDetails(ll_txt, lg.TypeNo); Add(lg); } catch (Exception ex) { is_find = false; } } } return(true); }
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); }
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(); } } } }
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); }
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(); } } //} }