public static SurveyData Parse(string line) { string kStr = MyStrings.RemoveAllSpaces(line.Replace(",", " ")); MyStrings mlist = new MyStrings(kStr, ' '); SurveyData sdata = new SurveyData(); if (mlist.Count == 5) { sdata.SerialNo = mlist.GetInt(0); sdata.X = mlist.GetDouble(1); sdata.Y = mlist.GetDouble(2); sdata.Z = mlist.GetDouble(3); sdata.FeatureCode = mlist.StringList[4]; } else if (mlist.Count == 4) { sdata.SerialNo = mlist.GetInt(0); sdata.X = mlist.GetDouble(1); sdata.Y = mlist.GetDouble(2); sdata.Z = mlist.GetDouble(3); sdata.FeatureCode = "OGL"; } else if (mlist.Count == 3) { //sdata.SerialNo = mlist.GetInt(0); sdata.X = mlist.GetDouble(0); sdata.Y = mlist.GetDouble(1); sdata.Z = mlist.GetDouble(2); sdata.FeatureCode = "P0"; } return(sdata); }
public static LoadData Parse(string txt) { //TYPE 2 -48.750 0 0.500 XINC 0.2 txt = txt.ToUpper().Replace("TYPE", ""); txt = txt.Replace(",", " "); txt = MyStrings.RemoveAllSpaces(txt); MyStrings mlist = new MyStrings(txt, ' '); LoadData ld = new LoadData(); ld.TypeNo = "TYPE " + mlist.GetInt(0); ld.X = mlist.GetDouble(1); ld.Y = mlist.GetDouble(2); ld.Z = mlist.GetDouble(3); if (mlist.StringList[4] == "XINC") { ld.XINC = mlist.GetDouble(5); } if (mlist.StringList[4] == "YINC") { ld.YINC = mlist.GetDouble(5); } if (mlist.StringList[4] == "ZINC") { ld.ZINC = mlist.GetDouble(5); } return(ld); }
public bool ReadFromFile(string file_name) { if (!File.Exists(file_name)) { return(false); } List <string> lstStr = new List <string>(File.ReadAllLines(file_name)); string kStr = ""; MyStrings mList = null; for (int i = 0; i < lstStr.Count; i++) { kStr = lstStr[i].Trim().TrimStart().TrimEnd(); mList = new MyStrings(kStr, '='); #region SWITCH switch (mList.StringList[0]) { case "size1": size1 = mList.StringList[1]; break; case "bgd": bgd = mList.StringList[1]; break; case "d1": d1 = mList.GetDouble(1); break; case "d2": d2 = mList.GetDouble(1); break; case "dist1": dist1 = mList.GetDouble(1); break; case "dist2": dist2 = mList.GetDouble(1); break; case "dist3": dist3 = mList.GetDouble(1); break; case "dist4": dist4 = mList.GetDouble(1); break; case "bno1": bno1 = mList.GetDouble(1); break; case "bno2": bno2 = mList.GetDouble(1); break; case "bno3": bno3 = mList.GetDouble(1); break; case "bno4": bno4 = mList.GetDouble(1); break; case "bno5": bno5 = mList.GetDouble(1); break; case "bwt1": bwt1 = mList.GetDouble(1); break; break; case "bwt2": bwt2 = mList.GetDouble(1); break; case "bwt3": bwt3 = mList.GetDouble(1); break; break; case "bwt4": bwt4 = mList.GetDouble(1); break; case "bwt5": bwt5 = mList.GetDouble(1); break; case "depth": depth = mList.GetDouble(1); break; case "shape1": shape1 = mList.GetDouble(1); break; case "shape2": shape2 = mList.GetDouble(1); break; case "shape3": shape3 = mList.GetDouble(1); break; case "shape4": shape4 = mList.GetDouble(1); break; } #endregion } lstStr.Clear(); return(true); }
public static bool ReadLineCoordinates(string fileName, vdDocument doc) { //vdArray<vdLine> line_arr = new vdArray<vdLine>(); List <string> lstStr = new List <string>(File.ReadAllLines(fileName)); string kStr = ""; string option = ""; string SP, EP, TEXT, IP, Height; SP = EP = IP = TEXT = Height = ""; MyStrings mList = null; for (int i = 0; i < lstStr.Count; i++) { kStr = lstStr[i].Trim().TrimEnd().TrimStart(); if (kStr == "VD_LINE") { option = "VD_LINE"; i++; SP = lstStr[i].Replace("SP=", ""); i++; EP = lstStr[i].Replace("EP=", ""); } else if (kStr == "VD_TEXT") { option = "VD_TEXT"; i++; IP = lstStr[i].Replace("IP=", ""); i++; TEXT = lstStr[i].Replace("TEXT=", ""); i++; Height = lstStr[i].Replace("HEIGHT=", ""); } switch (option) { case "VD_LINE": mList = new MyStrings(MyStrings.RemoveAllSpaces(SP), ','); vdLine ln = new vdLine(); ln.SetUnRegisterDocument(doc); ln.setDocumentDefaults(); ln.StartPoint.x = mList.GetDouble(0); ln.StartPoint.y = mList.GetDouble(1); ln.StartPoint.z = mList.GetDouble(2); mList = new MyStrings(MyStrings.RemoveAllSpaces(EP), ','); ln.EndPoint.x = mList.GetDouble(0); ln.EndPoint.y = mList.GetDouble(1); ln.EndPoint.z = mList.GetDouble(2); doc.ActiveLayOut.Entities.AddItem(ln); break; case "VD_TEXT": mList = new MyStrings(MyStrings.RemoveAllSpaces(IP), ','); vdText txt = new vdText(); txt.SetUnRegisterDocument(doc); txt.setDocumentDefaults(); txt.InsertionPoint.x = mList.GetDouble(0); txt.InsertionPoint.y = mList.GetDouble(1); txt.InsertionPoint.z = mList.GetDouble(2); txt.TextString = TEXT; txt.Height = MyStrings.StringToDouble(Height, 0.01); doc.ActiveLayOut.Entities.AddItem(txt); break; } } lstStr.Clear(); //doc.ShowUCSAxis = false; //VectorDraw.Professional.ActionUtilities.vdCommandAction.View3D_VTop(doc); //doc.Redraw(true); return(true); }
public void ReadFromFilFile(string flName) { //SLAB DESIGN //L = 3000.00 mm; B = 1000 m; D = 110.00 mm //h1 = 15.00 mm; h2 = 15.00 mm //ENFORCEMENT BAR //B1 = 250.00 mm; SPACING = 200.00 mm //END bool IsSlabFind = false; List <string> lstStr = new List <string>(File.ReadAllLines(flName)); string kStr = ""; MyStrings mList = null; for (int i = 0; i < lstStr.Count; i++) { kStr = MyStrings.RemoveAllSpaces(lstStr[i].Trim().TrimEnd().TrimStart().ToUpper()); if (kStr == "SLAB DESIGN") { IsSlabFind = true; continue; } else if (kStr == "END") { IsSlabFind = false; } if (IsSlabFind) { mList = new MyStrings(MyStrings.RemoveAllSpaces(kStr), ' '); for (int j = 0; j < mList.Count; j++) { switch (mList.StringList[j].Trim()) { case "L": totalLength = mList.GetDouble(j + 2); break; case "B": d_B = mList.GetDouble(j + 2); break; case "D": D = mList.GetDouble(j + 2); break; case "H1": h1 = mList.GetDouble(j + 2); break; case "H2": h2 = mList.GetDouble(j + 2); break; case "B1": B1 = mList.GetDouble(j + 2); break; case "MAIN SPACING": s1 = mList.GetDouble(j + 1); break; case "DIST SPACING": s2 = mList.GetDouble(j + 1); break; } } } } }
public void SetProcessBeam(string op, string text) { // ANALYSIS_REP.TXT // 1 1 1.598E+02 1.178E+01 -6.206E-01 -4.740E-02 -4.551E+00 1.693E+01 // -1.598E+02 -1.178E+01 6.206E-01 4.740E-02 7.033E+00 3.017E+01 string temp = text.ToUpper().Trim().TrimEnd().TrimStart().Replace('\t', ' '); while (temp.IndexOf(" ") != -1) { temp = temp.Replace(" ", " "); } MyStrings mList = new MyStrings(temp, ' '); try { if (mList.StringList.Count == 8) { // 1 1 1.598E+02 1.178E+01 -6.206E-01 -4.740E-02 -4.551E+00 1.693E+01 beamMoment = new BeamForceMoment(); beamMoment.Member.MemberNo = mList.GetInt(0); beamMoment.LoadCase = mList.GetInt(1); beamMoment.StartForceMoment.R1 = mList.GetDouble(2); beamMoment.StartForceMoment.R2 = mList.GetDouble(3); beamMoment.StartForceMoment.R3 = mList.GetDouble(4); beamMoment.StartForceMoment.M1 = mList.GetDouble(5); beamMoment.StartForceMoment.M2 = mList.GetDouble(6); beamMoment.StartForceMoment.M3 = mList.GetDouble(7); } if (mList.StringList.Count == 6) { // -1.598E+02 -1.178E+01 6.206E-01 4.740E-02 7.033E+00 3.017E+01 beamMoment.EndForceMoment.R1 = mList.GetDouble(0); beamMoment.EndForceMoment.R2 = mList.GetDouble(1); beamMoment.EndForceMoment.R3 = mList.GetDouble(2); beamMoment.EndForceMoment.M1 = mList.GetDouble(3); beamMoment.EndForceMoment.M2 = mList.GetDouble(4); beamMoment.EndForceMoment.M3 = mList.GetDouble(5); beamMomentCol.Add(beamMoment); } } catch (Exception exx) { } }
public void SetProcessNode(string op, string text) { //16 1 -0.64289E-02 -0.88362E-02 0.64941E-02 0.10075E-03 -0.16080E-03 0.75179E-02 string temp = text.ToUpper().Trim().TrimEnd().TrimStart().Replace('\t', ' '); int indx = -1; while (temp.IndexOf(" ") != -1) { temp = temp.Replace(" ", " "); } MyStrings mList = new MyStrings(temp, ' '); double dx = 0.0d, dy = 0.0d, dz = 0.0d; try { // 0 1 2 3 4 5 6 7 //16 1 -0.64289E-02 -0.88362E-02 0.64941E-02 0.10075E-03 -0.16080E-03 0.75179E-02 ndisp = new NodeDisplacement(); int index = 0; if (mList.StringList.Count == 8) { nodeNo = mList.GetInt(index); index++; ndisp.Node.NodeNo = nodeNo; ndisp.LoadCase = mList.GetInt(index); index++; ndisp.Tx = mList.GetDouble(index); index++; ndisp.Ty = mList.GetDouble(index); index++; ndisp.Tz = mList.GetDouble(index); index++; ndisp.Rx = mList.GetDouble(index); index++; ndisp.Ry = mList.GetDouble(index); index++; ndisp.Rz = mList.GetDouble(index); index++; nDispCol.Add(ndisp); } else if (mList.StringList.Count == 7) { ndisp.Node.NodeNo = nodeNo; ndisp.LoadCase = mList.GetInt(index); index++; ndisp.Tx = mList.GetDouble(index); index++; ndisp.Ty = mList.GetDouble(index); index++; ndisp.Tz = mList.GetDouble(index); index++; ndisp.Rx = mList.GetDouble(index); index++; ndisp.Ry = mList.GetDouble(index); index++; ndisp.Rz = mList.GetDouble(index); index++; nDispCol.Add(ndisp); } } catch (Exception exx) { } }
public void SetPostProcessForMovingLoad() { string memberForceFile = Path.GetDirectoryName(astDoc.FileName); memberForceFile = Path.Combine(memberForceFile, "Memberforce.FIL"); if (!File.Exists(memberForceFile)) { return; } List <string> lstStr = new List <string>(File.ReadAllLines(memberForceFile)); // MemberForce.FIL // 0 1 2 3 4 5 6 7 8 //MNO LDCS Node R1 R2 R3 M1 M2 M3 // 1 1 1 0.000 0.000 1.016 -0.157 -0.025 0.000 // 2 0.000 0.000 -1.016 0.157 -1.029 0.000 MyStrings mList = null; BeamForceMoment bfm = null; for (int i = 0; i < lstStr.Count; i++) { mList = new MyStrings(MyStrings.RemoveAllSpaces(lstStr[i]), ' '); if (mList.Count == 9) { bfm = new BeamForceMoment(); bfm.Member.MemberNo = mList.GetInt(0); bfm.LoadCase = mList.GetInt(1); bfm.StartForceMoment.R1 = mList.GetDouble(3); bfm.StartForceMoment.R2 = mList.GetDouble(4); bfm.StartForceMoment.R3 = mList.GetDouble(5); bfm.StartForceMoment.M1 = mList.GetDouble(6); bfm.StartForceMoment.M2 = mList.GetDouble(7); bfm.StartForceMoment.M3 = mList.GetDouble(8); } else if (mList.Count == 7) { //bfm = new BeamForceMoment(); //bfm.Member.MemberNo = mList.GetInt(0); //bfm.LoadCase = mList.GetInt(1); bfm.EndForceMoment.R1 = mList.GetDouble(1); bfm.EndForceMoment.R2 = mList.GetDouble(2); bfm.EndForceMoment.R3 = mList.GetDouble(3); bfm.EndForceMoment.M1 = mList.GetDouble(4); bfm.EndForceMoment.M2 = mList.GetDouble(5); bfm.EndForceMoment.M3 = mList.GetDouble(6); beamMomentCol.Add(bfm); } } }