public override void Command2(SubMenuBase menu) { var saveFileDialog = new Microsoft.Win32.SaveFileDialog() { Filter = "Result Files (*.calc)|*.calc", }; if (saveFileDialog.ShowDialog() != true) { return; } GlobalInfo globalInfo = GlobalInfo.GetInstance(); //StruCalsParas中塔位数据,是在点击这个塔位的页面后才加载的GlobalInfo中, //下面代码针对的是,没有打开这个塔位的页面而直接进行计算的情况 if (globalInfo.StruCalsParas.Where(item => item.TowerName == ((SubMenuBase)menu).Title && item.SequenceName == ((StrCalsModuleSubMenu)menu).Sequence).Count() <= 0) { if (((StrCalsModuleSubMenu)menu).Sequence == "") { 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; } ConvertSpecToWorkCondition(paras.Template, paras.WorkConditions, true); string path = saveFileDialog.FileName.Substring(0, saveFileDialog.FileName.Length - 5); for (int i = 0; i < paras.HPSettingsParas.Count(); i++) { LoadComposeBase loadCompose; if (paras.BaseParas.Type == TowerTypeEnum.LineTower) { loadCompose = new LoadComposeLineTower(paras.BaseParas, paras.LineParas.ToArray(), paras.HPSettingsParas[i], paras.Template, paras.ElectricalLoadFilePath); } else if (paras.BaseParas.Type == TowerTypeEnum.LineCornerTower) { loadCompose = new LoadComposeLineCornerTower(paras.BaseParas, paras.LineParas.ToArray(), paras.HPSettingsParas[i], paras.Template, paras.ElectricalLoadFilePath); } //剩下的都属于耐张塔 else { loadCompose = new LoadComposeTensionTower(paras.BaseParas, paras.LineParas.ToArray(), paras.HPSettingsParas[i], paras.Template, paras.ElectricalLoadFilePath); } paras.ResultPointLoad.AddRange(loadCompose.LoadCaculate(path)); } }
public void TestMethod7() { var openFileDialog = new Microsoft.Win32.OpenFileDialog() { Filter = "DLL Files (*.dll)|*.dll" }; if (openFileDialog.ShowDialog() != true) { return; } var openTemplateDialog = new Microsoft.Win32.OpenFileDialog() { Filter = "Excel Files (*.xlsx)|*.xlsx" }; if (openTemplateDialog.ShowDialog() != true) { return; } var saveFileDialog = new Microsoft.Win32.SaveFileDialog() { Filter = "Dat Files (*.dat)|*.dat", }; if (saveFileDialog.ShowDialog() != true) { return; } DES.DesDecrypt(openFileDialog.FileName, saveFileDialog.FileName, "12345678"); TowerTemplateReader TemplateReader = new TowerTemplateReader(TowerTypeEnum.LineTower); Mode.TowerTemplate template = TemplateReader.Read(saveFileDialog.FileName); StruCalseBaseParas formulaParas = new StruCalseBaseParas(); formulaParas.Type = TowerTypeEnum.LineTower; formulaParas.LoadRatio = 1; //结构重要性系数 formulaParas.R1Install = 1f; formulaParas.R0Normal = 1.1f; //荷载分项系数 formulaParas.RGBad = 1.2f; formulaParas.RGGood = 1f; formulaParas.RQ = 1.4f; //可变荷载组合系数 formulaParas.VcFNormal = 1f; formulaParas.VcFInstall = 0.9f; formulaParas.VcFBroken = 0.9f; formulaParas.VcFUnevenIce = 0.9f; formulaParas.VcFCheck = 0.75f; //其他参数 formulaParas.WindAdjustFactor = 1f; formulaParas.OtherWindAdjustFactor = 1f; formulaParas.DynamicCoef = 1.1f; formulaParas.AnchorWindCoef = 0.7f; formulaParas.AnchorGravityCoef = 0.7f; formulaParas.AnchorAngle = 20f; formulaParas.IsMethod1Selected = true; StruLineParas[] lineParas = new StruLineParas[] { new StruLineParas { HoistingCoef = 2f, WireExtraLoad = 4, AnchorTension = 43.32f, PulleyTensionDif = 0, DrawingCoef = 1.2f }, new StruLineParas { HoistingCoef = 2f, WireExtraLoad = 4, AnchorTension = 43.32f, PulleyTensionDif = 0, DrawingCoef = 1.2f }, new StruLineParas { HoistingCoef = 1.5f, WireExtraLoad = 8, AnchorTension = 829.39f, PulleyTensionDif = 50, DrawingCoef = 1.2f }, new StruLineParas { HoistingCoef = 1.5f, WireExtraLoad = 8, AnchorTension = 829.39f, PulleyTensionDif = 50, DrawingCoef = 1.2f } }; List <HangingPointParas> normalList = new List <HangingPointParas>() { new HangingPointParas() { Index = 1, WireType = "左地", StringType = "常规", Points = new string[] { "11", "13" } }, new HangingPointParas() { Index = 2, WireType = "右地", StringType = "常规", Points = new string[] { "10", "12" } }, new HangingPointParas() { Index = 3, WireType = "左导", StringType = "V1", Points = new string[] { "421", "1241" } }, new HangingPointParas() { Index = 4, WireType = "右导", StringType = "V1", Points = new string[] { "1240", "420" } } }; List <HangingPointParas> installList = new List <HangingPointParas>() { new HangingPointParas() { Index = 1, WireType = "左导", Array = "第a组", Points = new string[] { "671", "673", "781", "783" } }, new HangingPointParas() { Index = 2, WireType = "右导", Array = "第a组", Points = new string[] { "670", "672", "780", "782" } }, new HangingPointParas() { Index = 3, WireType = "左导", Array = "第b组", Points = new string[] { "611", "613", "671", "673", "781", "783", "791", "793" } }, new HangingPointParas() { Index = 4, WireType = "右导", Array = "第b组", Points = new string[] { "610", "612", "670", "672", "780", "782", "790", "792" } }, new HangingPointParas() { Index = 5, WireType = "左导", Array = "第c组", Points = new string[] { "671", "673", "781", "783" } }, new HangingPointParas() { Index = 6, WireType = "右导", Array = "第c组", Points = new string[] { "670", "672", "780", "782" } }, }; List <HangingPointParas> turningPoingts = new List <HangingPointParas> { new HangingPointParas { Index = 1, WireType = "左导", Angle = 90, Points = new string[] { "1001", "1003" } }, new HangingPointParas { Index = 2, WireType = "右导", Angle = -90, Points = new string[] { "1000", "1002" } }, }; List <VStringParas> vStringList = new List <VStringParas>() { new VStringParas() { Index = "V1", L1 = 8350, H1 = 9940, L2 = 8350, H2 = 9940, StressLimit = 0, Angle = 0 }, }; HangingPointSettingParas ratioParas = new HangingPointSettingParas() { GCQ = 0.5f, GCH = 0.5f, GXN = -1, GXW = 2, DQWQ = 0.7f, DQWH = 0.3f, DQCQ = 0.7f, DQCH = 0.3f, DDWQ = 0.7f, DDWH = 0.3f, DDCQ = 0.7f, DDCH = 0.3f, DMWQ = 0.7f, DMWH = 0.3f, DMCQ = 0.7f, DMCH = 0.3f, IsTuringPointSeleced = true, NormalXYPoints = normalList, NormalZPoints = normalList, InstallXYPoints = installList, InstallZPoints = installList, TurningPoints = turningPoingts, VStrings = vStringList, }; LoadComposeLineTower loadLineTower = new LoadComposeLineTower(formulaParas, lineParas, ratioParas, template, openTemplateDialog.FileName); string filePath = saveFileDialog.FileName.Substring(0, saveFileDialog.FileName.Length - 3) + "cals"; loadLineTower.CalculateLoadDistribute(filePath); string filePath2 = saveFileDialog.FileName.Substring(0, saveFileDialog.FileName.Length - 3) + "div"; List <StruCalsPointLoad> loadList = loadLineTower.CalsPointsLoad(filePath2); string filePath3 = saveFileDialog.FileName.Substring(0, saveFileDialog.FileName.Length - 3) + "load"; loadLineTower.GenerateLoadFile(filePath3, loadList); }