public void GetResults() { RobotResultServer results = _structure.Results; _displacementServer = results.Nodes.Displacements; _caseServer = _structure.Cases; _stressServer = _structure.Results.Bars.Stresses; }
//This method generates all structure loads in the system public void generateStructureLoads(double concentratedLoad, double c, double e) { //check if the loads have already been created. In case they were created delete all cases if (loadsGenerated) { RobotSelection iAllCases = iRobotApp.Project.Structure.Selections.CreateFull(IRobotObjectType.I_OT_CASE); iRobotApp.Project.Structure.Cases.DeleteMany(iAllCases); } //Get reference to load cases server IRobotCaseServer iCases = (IRobotCaseServer)iRobotApp.Project.Structure.Cases; //Get first available (free) user number for load int caseNumber = iCases.FreeNumber; //Create DeadLoad case IRobotSimpleCase deadLoadCase = (IRobotSimpleCase)iCases.CreateSimple(caseNumber, "Peso Proprio", IRobotCaseNature.I_CN_PERMANENT, IRobotCaseAnalizeType.I_CAT_STATIC_LINEAR); IRobotLoadRecord2 deadLoadRecord = (IRobotLoadRecord2)deadLoadCase.Records.Create(IRobotLoadRecordType.I_LRT_DEAD); deadLoadRecord.SetValue((short)IRobotDeadRecordValues.I_DRV_ENTIRE_STRUCTURE, (double)1); //Create First lifiting load case IRobotSimpleCase lifitingCase1 = (IRobotSimpleCase)iCases.CreateSimple(caseNumber + 1, "Talha 1", IRobotCaseNature.I_CN_ACCIDENTAL, IRobotCaseAnalizeType.I_CAT_STATIC_LINEAR); //Calculate the relative position of the load double relativePosition1 = ((c - e) / 2) / c; createConcentratedLoad(lifitingCase1, relativePosition1, concentratedLoad, bars[5]); //Create second lifting load case IRobotSimpleCase liftingCase2 = (IRobotSimpleCase)iCases.CreateSimple(caseNumber + 2, "Talha 2", IRobotCaseNature.I_CN_ACCIDENTAL, IRobotCaseAnalizeType.I_CAT_STATIC_LINEAR); createConcentratedLoad(liftingCase2, 0.5, concentratedLoad, bars[5]); //Create load combinations IRobotCaseCombination uls1 = (IRobotCaseCombination)iCases.CreateCombination(caseNumber + 3, "ULS-1", IRobotCombinationType.I_CBT_ULS, IRobotCaseNature.I_CN_ACCIDENTAL, IRobotCaseAnalizeType.I_CAT_COMB); uls1.CaseFactors.New(caseNumber, (double)1.0); uls1.CaseFactors.New(caseNumber + 1, (double)1.0); IRobotCaseCombination uls2 = (IRobotCaseCombination)iCases.CreateCombination(caseNumber + 4, "ULS-2", IRobotCombinationType.I_CBT_ULS, IRobotCaseNature.I_CN_ACCIDENTAL, IRobotCaseAnalizeType.I_CAT_COMB); uls2.CaseFactors.New(caseNumber, (double)1.0); uls2.CaseFactors.New(caseNumber + 2, 1.0); IRobotCaseCombination sls1 = (IRobotCaseCombination)iCases.CreateCombination(caseNumber + 5, "SLS-1", IRobotCombinationType.I_CBT_SLS, IRobotCaseNature.I_CN_ACCIDENTAL, IRobotCaseAnalizeType.I_CAT_COMB); sls1.CaseFactors.New(caseNumber, 1.0); sls1.CaseFactors.New(caseNumber + 1, 1.0); IRobotCaseCombination sls2 = (IRobotCaseCombination)iCases.CreateCombination(caseNumber + 6, "SLS-2", IRobotCombinationType.I_CBT_SLS, IRobotCaseNature.I_CN_ACCIDENTAL, IRobotCaseAnalizeType.I_CAT_COMB); sls2.CaseFactors.New(caseNumber, 1.0); sls2.CaseFactors.New(caseNumber + 2, 1.0); loadsGenerated = true; }//createConcentratedLoad
public static void InitRobot() { robotApp = new RobotApplication(); nodeServer = robotApp.Project.Structure.Nodes; barServer = robotApp.Project.Structure.Bars; caseServer = robotApp.Project.Structure.Cases; labelServer = robotApp.Project.Structure.Labels; PrefrencesServer = robotApp.Project.Preferences; barForceServer = robotApp.Project.Structure.Results.Bars.Forces; }
/// <summary> /// 进行荷载组合,考虑冲突荷载 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button1_Click_1(object sender, EventArgs e) { //第一步,从元素表格里面获取所有元素,组成数组 string[] elementArr = GetCaseInput(); //数组 string[] elementArrWithNotNullElement = RemoveNullElement(elementArr); for (int i = 0; i < elementArrWithNotNullElement.Length; i++) { //求元素数组的所有组合 List <string[]> ListCombination = PermutationAndCombination <string> .GetCombination(elementArrWithNotNullElement, i + 1); //第一个参数是数据源,第二个参数是从中选取的元素数量 //将结果输出到结果表格中去 foreach (var arr in ListCombination) { if (InvalidLoadCombine(arr)) { string result = string.Empty; result = string.Join("+", arr);//数组转成字符串 int index = dataGridViewOutPut.Rows.Add(); dataGridViewOutPut.Rows[index].Cells[0].Value = result; } } } //获取本项目的荷载容器 IRobotCaseServer icases = (IRobotCaseServer)iapp.Project.Structure.Cases; //获取可用荷载编号 int c1 = icases.FreeNumber; List <LoadInfo> loadList = new List <LoadInfo>(); loadList = GetLoadInfo(); List <caseInfo> caseList = new List <caseInfo>(); for (int i = 0; i < loadList.Count; i++) { //创建一个荷载(I_LRT_BAR_UNIFORM) //IRobotSimpleCase isc1 = (IRobotSimpleCase)icases.CreateSimple(c1+i, loadList[i].LoadName, IRobotCaseNature.I_CN_ACCIDENTAL, IRobotCaseAnalizeType.I_CAT_STATIC_LINEAR); IRobotSimpleCase isc1 = (IRobotSimpleCase)icases.CreateSimple(c1 + i, loadList[i].LoadName, IRobotCaseNature.I_CN_ACCIDENTAL, IRobotCaseAnalizeType.I_CAT_STATIC_LINEAR); //给荷载赋值 BeamTools.create_concentrated_load(isc1, loadList[i].ElementNumber, 0.5, loadList[i].LoadValue); caseInfo temp = new caseInfo(); temp.CaseName = loadList[i].LoadName; temp.CaseNumber = c1 + i; caseList.Add(temp); } string[] allCombines = GetAllLoadCombines(); for (int i = 0; i < allCombines.Length; i++) { //添加荷载组合 if (!string.IsNullOrEmpty(allCombines[i])) { IRobotCaseCombination icc = (IRobotCaseCombination)icases.CreateCombination(i + c1 + loadList.Count + 1, allCombines[i], IRobotCombinationType.I_CBT_ULS, IRobotCaseNature.I_CN_EXPLOATATION, IRobotCaseAnalizeType.I_CAT_COMB); string[] loadsArray = allCombines[i].Split('+'); for (int j = 0; j < loadsArray.Length; j++) { int caseNumber = getCaseNumber(caseList, loadsArray[j]); icc.CaseFactors.New(caseNumber, 1); } } } // loadsGenerated = true; }
// generate loads private void generateLoads(object sender, EventArgs e) { if (!geometryCreated)//如果没有创建几何 { // geometry must be created first //创建几何 createGeometry(sender, e); } // switch Interactive flag off to avoid any questions that need user interaction in Robot //关闭robot的交互 iapp.Interactive = 0; if (loadsGenerated)//如果几何已经创建好 { // remove all existing load cases //将现有工况全部清除 RobotSelection iallCases = iapp.Project.Structure.Selections.CreateFull(IRobotObjectType.I_OT_CASE); iapp.Project.Structure.Cases.DeleteMany(iallCases); } // get reference to load cases server //获取本项目的工况集合 IRobotCaseServer icases = (IRobotCaseServer)iapp.Project.Structure.Cases; // get first available (free) user number for load case //获取可用工况编号 int c1 = icases.FreeNumber; if (checkDeadLoad.Checked)//如果选中了自重荷载 { // create dead load case //创建自重工况 IRobotSimpleCase isc1 = (IRobotSimpleCase)icases.CreateSimple(c1, "Dead load", IRobotCaseNature.I_CN_PERMANENT, IRobotCaseAnalizeType.I_CAT_STATIC_LINEAR); // define dead load record for the entire structure //定义自重荷载,添加到自重工况里面取 IRobotLoadRecord2 ilr1 = (IRobotLoadRecord2)isc1.Records.Create(IRobotLoadRecordType.I_LRT_DEAD); ilr1.SetValue((short)IRobotDeadRecordValues.I_DRV_ENTIRE_STRUCTURE, (double)1); ++c1; } // create live load case //创建活荷载工况 IRobotSimpleCase isc = (IRobotSimpleCase)icases.CreateSimple(c1, "Live load", IRobotCaseNature.I_CN_ACCIDENTAL, IRobotCaseAnalizeType.I_CAT_STATIC_LINEAR); // convert force value from kN to N and change the direction //荷载格式转换 double val = -1000 * System.Convert.ToDouble(editIntensity1.Text); // add force concentrated load records in 5 points on the beams //给活荷载工况添加荷载 create_concentrated_load(isc, 0.0, 0.5 * val); create_concentrated_load(isc, 0.25, val); create_concentrated_load(isc, 0.5, val); create_concentrated_load(isc, 0.75, val); create_concentrated_load(isc, 1.0, 0.5 * val); // create live load case //创建另外一个荷载工况 isc = (IRobotSimpleCase)icases.CreateSimple(c1 + 1, "Exploitation load", IRobotCaseNature.I_CN_EXPLOATATION, IRobotCaseAnalizeType.I_CAT_STATIC_LINEAR); // convert force value from kN to N and change the direction //把荷载值从KN转换成N val = -1000 * System.Convert.ToDouble(editIntensity2.Text); // add force concentrated load records in 5 points on the beams //将荷载作用到梁上面 create_concentrated_load(isc, 0.0, 0.5 * val); create_concentrated_load(isc, 0.25, val); create_concentrated_load(isc, 0.5, val); create_concentrated_load(isc, 0.75, val); create_concentrated_load(isc, 1.0, 0.5 * val); // create wind load applied to columns //添加荷载工况,风荷载 isc = (IRobotSimpleCase)icases.CreateSimple(c1 + 2, "Wind load", IRobotCaseNature.I_CN_WIND, IRobotCaseAnalizeType.I_CAT_STATIC_LINEAR); IRobotLoadRecord2 ilr = (IRobotLoadRecord2)isc.Records.Create(IRobotLoadRecordType.I_LRT_BAR_UNIFORM); ilr.SetValue((short)IRobotBarUniformRecordValues.I_BURV_PZ, 1000 * System.Convert.ToDouble(editIntensity3.Text)); ilr.SetValue((short)IRobotBarUniformRecordValues.I_BURV_LOCAL, 1.0); ilr.Objects.AddOne(beam1 - 1); ilr.Objects.AddOne(beam2 + 1); // create combinations //添加荷载组合 IRobotCaseCombination icc = (IRobotCaseCombination)icases.CreateCombination(c1 + 3, "Comb ULS", IRobotCombinationType.I_CBT_ULS, IRobotCaseNature.I_CN_EXPLOATATION, IRobotCaseAnalizeType.I_CAT_COMB); icc.CaseFactors.New(c1, System.Convert.ToDouble(editUls1.Text)); icc.CaseFactors.New(c1 + 1, System.Convert.ToDouble(editUls2.Text)); icc.CaseFactors.New(c1 + 2, System.Convert.ToDouble(editUls3.Text)); icc = (IRobotCaseCombination)icases.CreateCombination(c1 + 4, "Comb SLS", IRobotCombinationType.I_CBT_SLS, IRobotCaseNature.I_CN_EXPLOATATION, IRobotCaseAnalizeType.I_CAT_COMB); icc.CaseFactors.New(c1, System.Convert.ToDouble(editSls1.Text)); icc.CaseFactors.New(c1 + 1, System.Convert.ToDouble(editSls2.Text)); icc.CaseFactors.New(c1 + 2, System.Convert.ToDouble(editSls3.Text)); loadsGenerated = true; // switch Interactive flag on to allow user to work with Robot GUI //允许ROBOT界面交互 iapp.Interactive = 1; // get the focus back //获取焦点 this.Activate(); }