public void TestMethod2_SmartTowerGenerator() { var openLoadDialog = new Microsoft.Win32.OpenFileDialog() { Filter = "Load Files (*.load)|*.load" }; if (openLoadDialog.ShowDialog() != true) { return; } var openTemplateDialog = new Microsoft.Win32.OpenFileDialog() { Filter = "Dat Files (*.dat)|*.dat" }; if (openTemplateDialog.ShowDialog() != true) { return; } string rlt = SmartTowerInputGenerator.InputGenerator(openLoadDialog.FileName, openTemplateDialog.FileName); }
public override void Command3(SubMenuBase menu) { var loadFileDialog = new Microsoft.Win32.OpenFileDialog() { Filter = "Load Files (*.load)|*.load", }; if (loadFileDialog.ShowDialog() != true) { return; } string stQtPath = GlobalInfo.GetInstance().GetSmartTowerPath(); if (stQtPath == null || stQtPath == "") { MessageBox.Show(" 请设置SmartTower程序的路径!"); return; } if (!File.Exists(stQtPath)) { MessageBox.Show("无法找到SmartTower,请设置它的路径!"); return; } string stConsolePath = stQtPath.Substring(0, stQtPath.LastIndexOf("\\")) + "\\" + ConstVar.SmartTowerConsoleName; if (!File.Exists(stConsolePath)) { return; } string mode = GlobalInfo.GetInstance().GetSmartTowerMode().ToString(); GlobalInfo globalInfo = GlobalInfo.GetInstance(); if (globalInfo.StruCalsParas.Where(item => item.TowerName == ((SubMenuBase)menu).Title && item.SequenceName == ((StrCalsModuleSubMenu)menu).Sequence).Count() <= 0) { if (((StrCalsModuleSubMenu)menu).Sequence == null) { ProjectUtils.GetInstance().ReadStruCalsTowerParas(((SubMenuBase)menu).Title); } else { ProjectUtils.GetInstance().ReadStruCalsTowerParas(((SubMenuBase)menu).Title, ((StrCalsModuleSubMenu)menu).Sequence); } } StruCalsParasCompose paras = globalInfo.StruCalsParas.Where(para => para.TowerName == ((SubMenuBase)menu).Title && para.SequenceName == ((StrCalsModuleSubMenu)menu).Sequence).FirstOrDefault(); if (paras == null) { return; } string path = paras.FullStressTemplatePaths[0]; if (!File.Exists(path)) { return; } SmartTowerInputGenerator.InputGenerator(loadFileDialog.FileName, path); string stParas = path + " " + mode; //string stParas1 = "C:\\Users\\zhifei\\Desktop\\测试\\StruCals\\直线塔7\\满应力分析\\Z31.dat 0"; //0: 正常计算 1:基础作用力BetaZ=1 2:基础作用力betaZ=-1/2+1 不容许有空格 ProcessStartInfo startInfo = new ProcessStartInfo(stConsolePath, stParas); //startInfo.UseShellExecute = false; //startInfo.CreateNoWindow = true; Process process = new Process(); process.StartInfo = startInfo; process.Start(); process.WaitForExit(); //} TowerMemberBLL memberBLL = new TowerMemberBLL(); string outPath = path.Substring(0, path.LastIndexOf(".")) + ".out"; paras.ResultFullStess = memberBLL.TextFileReadAll(outPath).ToList(); }