public static bool DrawBeam(int beamId, Node _startPoint, Node _endPoint) { robotApp.Interactive = 0; nodeServer.Create(_startPoint.Id, _startPoint.X, _startPoint.Y, _startPoint.Z); nodeServer.Create(_endPoint.Id, _endPoint.X, _endPoint.Y, _endPoint.Z); barServer.Create(beamId, _startPoint.Id, _endPoint.Id); robotApp.Interactive = 1; return(true); }
}//createFrame private void addRobotBars(int startIndex, string column, string railBeam, string wheelBeam, string simpleBar) { IRobotBarServer iBars = iRobotApp.Project.Structure.Bars; //Bar selection RobotSelection barSelection = iRobotApp.Project.Structure.Selections.Create(IRobotObjectType.I_OT_BAR); for (int i = startIndex; i < bars.Count; i++) { //Create the bars in the Robot Software iBars.Create(bars[i].id, bars[i].startNode.id, bars[i].endNode.id); //Clear the previous selection barSelection.Clear(); //Add the current bar to the selection barSelection.AddOne(bars[i].id); //Assign the profile switch (bars[i].type) { case MemberType.Column: bars[i].sectionLabel = column; break; case MemberType.RailBeam: bars[i].sectionLabel = railBeam; break; case MemberType.WheelBeam: bars[i].sectionLabel = wheelBeam; break; case MemberType.Bar: bars[i].sectionLabel = simpleBar; break; default: break; } //Setting the label iBars.SetLabel(barSelection, IRobotLabelType.I_LT_BAR_SECTION, bars[i].sectionLabel); } }//addRobotBars
// create the structure geometry //建立结构的集合模型 private void createGeometry(object sender, EventArgs e) { // switch Interactive flag off to avoid any questions that need user interaction in Robot //关闭和ROBOT的交互功能 iapp.Interactive = 0; // create a new project of type Frame 2D //创建一个Frame2d类型的项目 iapp.Project.New(IRobotProjectType.I_PT_FRAME_2D); // create nodes //创建节点 double x = 0, y = 0; double h = System.Convert.ToDouble(editH.Text); //获取高度 double l = System.Convert.ToDouble(editL.Text); //获取长度 double alpha = System.Convert.ToDouble(editA.Text); //获取角度 IRobotNodeServer inds = iapp.Project.Structure.Nodes; //获取节点集合 int n1 = startNode; inds.Create(n1, x, 0, y);//创建节点,格式为节点号,x坐标,y坐标,z坐标 inds.Create(n1 + 1, x, 0, y + h); inds.Create(n1 + 2, x + (l / 2), 0, y + h + Math.Tan(alpha * (Math.PI / 180)) * l / 2); inds.Create(n1 + 3, x + l, 0, y + h); inds.Create(n1 + 4, x + l, 0, 0); // create bars //创建杆单元 IRobotBarServer ibars = iapp.Project.Structure.Bars;//获取杆单元集合 int b1 = startBar; ibars.Create(b1, n1, n1 + 1);//创建杆单元,格式为单元号,单元起始节点,单元结束节点 ibars.Create(b1 + 1, n1 + 1, n1 + 2); beam1 = b1 + 1; ibars.Create(b1 + 2, n1 + 2, n1 + 3); beam2 = b1 + 2; ibars.Create(b1 + 3, n1 + 3, n1 + 4); // set selected bar section label to columns //给柱子设置截面 RobotSelection isel = iapp.Project.Structure.Selections.Create(IRobotObjectType.I_OT_BAR); isel.AddOne(b1); isel.AddOne(b1 + 3); ibars.SetLabel(isel, IRobotLabelType.I_LT_BAR_SECTION, comboColumns.Text); // set selected bar section label to beams //给梁设置截面 isel.Clear(); isel.AddOne(b1 + 1); isel.AddOne(b1 + 2); ibars.SetLabel(isel, IRobotLabelType.I_LT_BAR_SECTION, comboBeams.Text); // set selected support label to nodes //给节点设置支持形式 IRobotNode ind = (IRobotNode)inds.Get(n1); ind.SetLabel(IRobotLabelType.I_LT_SUPPORT, comboSupportLeft.Text); ind = (IRobotNode)inds.Get(n1 + 4); ind.SetLabel(IRobotLabelType.I_LT_SUPPORT, comboSupportRight.Text); geometryCreated = true; //结构几何创建结束 loadsGenerated = false; //结构荷载没有创建 // switch Interactive flag on to allow user to work with Robot GUI //打开robot截面操作 iapp.Interactive = 1; // get the focus back this.Activate(); }
/// <summary> /// 创建连续梁模型 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button3_Click(object sender, EventArgs e) { //截面宽度,高度 double sectionWidth = double.Parse(txtSectionWdith.Text); double sectionHeight = double.Parse(txtSectionHeight.Text); //材料 // string material=comboBoxMaterial.SelectedItem.ToString(); //几何跨数,单跨长度 int elementAmount = int.Parse(comboBoxElementCount.SelectedItem.ToString()); double elementLength = double.Parse(textBoxElementLength.Text); //----------------------------------------------------------------------- //关闭和ROBOT的交互功能 iapp.Interactive = 0; //创建一个Frame2d类型的项目 iapp.Project.New(IRobotProjectType.I_PT_FRAME_2D); //创建节点 IRobotNodeServer inds = iapp.Project.Structure.Nodes;//获取节点集合 int n1 = startNode; inds.Create(n1, 0, 0, 0); for (int i = 1; i < elementAmount + 1; i++)//创建节点,格式为节点号,x坐标,y坐标,z坐标 { inds.Create(i + 1, i * elementLength, 0, 0); } //创建杆单元 IRobotBarServer ibars = iapp.Project.Structure.Bars;//获取杆单元集合 int b1 = startBar; for (int i = 1; i < elementAmount + 1; i++) { ibars.Create(i, i, i + 1);//创建杆单元,格式为单元号,单元起始节点,单元结束节点 } //设置材料和截面 //给量赋值截面 RobotLabelServer labels; labels = iapp.Project.Structure.Labels; string ColumnSectionName = "Rect. Column 60*100"; IRobotLabel label = labels.Create(IRobotLabelType.I_LT_BAR_SECTION, ColumnSectionName); RobotBarSectionData section; section = (RobotBarSectionData)label.Data; section.ShapeType = IRobotBarSectionShapeType.I_BSST_CONCR_COL_R; RobotBarSectionConcreteData concrete; concrete = (RobotBarSectionConcreteData)section.Concrete; concrete.SetValue(IRobotBarSectionConcreteDataValue.I_BSCDV_COL_B, 0.6); concrete.SetValue(IRobotBarSectionConcreteDataValue.I_BSCDV_COL_H, 1.0); section.CalcNonstdGeometry(); labels.Store(label); RobotSelection selectionBars; selectionBars = iapp.Project.Structure.Selections.Get(IRobotObjectType.I_OT_BAR); //selectionBars.FromText("1 2 3 4 5"); selectionBars.AddOne(1); selectionBars.AddOne(2); selectionBars.AddOne(3); selectionBars.AddOne(4); selectionBars.AddOne(5); //给量赋值截面 string MaterialName = "Concrete 30"; label = labels.Create(IRobotLabelType.I_LT_MATERIAL, MaterialName); RobotMaterialData Material; Material = (RobotMaterialData)label.Data; Material.Type = IRobotMaterialType.I_MT_CONCRETE; Material.E = 30000000000; // Young Material.NU = 1 / 6; // Poisson Material.RO = 25000; // Unit weight Material.Kirchoff = Material.E / (2 * (1 + Material.NU)); iapp.Project.Structure.Labels.Store(label); RobotSelection isel = iapp.Project.Structure.Selections.Create(IRobotObjectType.I_OT_BAR); isel.AddOne(1); isel.AddOne(2); isel.AddOne(3); isel.AddOne(4); isel.AddOne(5); ibars.SetLabel(isel, IRobotLabelType.I_LT_BAR_SECTION, ColumnSectionName); //ibars.SetLabel(isel, IRobotLabelType.I_LT_MATERIAL, MaterialName); //------------------------------------------------ //支撑 //给节点设置支持形式 IRobotNode ind = (IRobotNode)inds.Get(1); ind.SetLabel(IRobotLabelType.I_LT_SUPPORT, "固定"); //ind.SetLabel(IRobotLabelType.I_LT_SUPPORT, comboSupportLeft.Text); geometryCreated = true; //结构几何创建结束 loadsGenerated = false; //结构荷载没有创建 // switch Interactive flag on to allow user to work with Robot GUI //打开robot截面操作 iapp.Interactive = 1; // get the focus back this.Activate(); }
private void CreateBars(List <int> forDeadLoadsBars) { //create the tube section //type 1 IRobotLabel sec1 = _structure.Labels.Create(IRobotLabelType.I_LT_BAR_SECTION, "CatiaTubeSection_00"); IRobotBarSectionData data1 = sec1.Data as IRobotBarSectionData; data1.Type = IRobotBarSectionType.I_BST_NS_TUBE; data1.ShapeType = IRobotBarSectionShapeType.I_BSST_USER_TUBE; IRobotBarSectionNonstdData nonst_data1 = data1.CreateNonstd(0); //type 2 IRobotLabel sec2 = _structure.Labels.Create(IRobotLabelType.I_LT_BAR_SECTION, "CatiaTubeSection_01"); IRobotBarSectionData data2 = sec2.Data as IRobotBarSectionData; data2.Type = IRobotBarSectionType.I_BST_NS_TUBE; data2.ShapeType = IRobotBarSectionShapeType.I_BSST_USER_TUBE; IRobotBarSectionNonstdData nonst_data2 = data2.CreateNonstd(0); //type 3 IRobotLabel sec3 = _structure.Labels.Create(IRobotLabelType.I_LT_BAR_SECTION, "CatiaTubeSection_02"); IRobotBarSectionData data3 = sec3.Data as IRobotBarSectionData; data3.Type = IRobotBarSectionType.I_BST_NS_TUBE; data3.ShapeType = IRobotBarSectionShapeType.I_BSST_USER_TUBE; IRobotBarSectionNonstdData nonst_data3 = data3.CreateNonstd(0); //create the plate section IRobotLabel sec4 = _structure.Labels.Create(IRobotLabelType.I_LT_BAR_SECTION, "CatiaPlateSection_00"); IRobotBarSectionData data4 = sec4.Data as IRobotBarSectionData; data4.Type = IRobotBarSectionType.I_BST_NS_RECT; data4.ShapeType = IRobotBarSectionShapeType.I_BSST_USER_RECT; IRobotBarSectionNonstdData nonst_data4 = data4.CreateNonstd(0); IRobotLabel sec5 = _structure.Labels.Create(IRobotLabelType.I_LT_BAR_SECTION, "CatiaPlateSection_01"); IRobotBarSectionData data5 = sec5.Data as IRobotBarSectionData; data5.Type = IRobotBarSectionType.I_BST_NS_RECT; data5.ShapeType = IRobotBarSectionShapeType.I_BSST_USER_RECT; IRobotBarSectionNonstdData nonst_data5 = data5.CreateNonstd(0); IRobotLabel sec6 = _structure.Labels.Create(IRobotLabelType.I_LT_BAR_SECTION, "CatiaPlateSection_02"); IRobotBarSectionData data6 = sec6.Data as IRobotBarSectionData; data6.Type = IRobotBarSectionType.I_BST_NS_RECT; data6.ShapeType = IRobotBarSectionShapeType.I_BSST_USER_RECT; IRobotBarSectionNonstdData nonst_data6 = data6.CreateNonstd(0); //create a cable section IRobotLabel sec7 = _structure.Labels.Create(IRobotLabelType.I_LT_BAR_CABLE, "CatiaCable"); IRobotBarCableData data7 = sec7.Data as IRobotBarCableData; data7.SectionAX = Math.PI * (Math.Pow((_sectionInfo[4] / 1000), 2)); //the area formula using the cable radius parameter data7.MaterialName = "STEEL"; if (_barInfo.Count != 0) { // double sectionDiameter = _barInfo[0].Diameter/1000; //the diameter in meters // double sectionthickness = _barInfo[0].SectionThickness/1000; //the thickness in meters //set the values of the tubes nonst_data1.SetValue(IRobotBarSectionNonstdDataValue.I_BSNDV_TUBE_D, _sectionInfo[0] / 1000); //the section diameter nonst_data1.SetValue(IRobotBarSectionNonstdDataValue.I_BSNDV_TUBE_T, _sectionInfo[1] / 1000); //the section thickness data1.CalcNonstdGeometry(); _structure.Labels.Store(sec1); nonst_data2.SetValue(IRobotBarSectionNonstdDataValue.I_BSNDV_TUBE_D, _sectionInfo[2] / 1000); //the section diameter nonst_data2.SetValue(IRobotBarSectionNonstdDataValue.I_BSNDV_TUBE_T, _sectionInfo[3] / 1000); //the section thickness data2.CalcNonstdGeometry(); _structure.Labels.Store(sec2); nonst_data3.SetValue(IRobotBarSectionNonstdDataValue.I_BSNDV_TUBE_D, _sectionInfo[4] / 1000); //the section diameter nonst_data3.SetValue(IRobotBarSectionNonstdDataValue.I_BSNDV_TUBE_T, _sectionInfo[5] / 1000); //the section thickness data3.CalcNonstdGeometry(); _structure.Labels.Store(sec3); //set the values of the plate nonst_data4.SetValue(IRobotBarSectionNonstdDataValue.I_BSNDV_RECT_H, _sectionInfo[6] / 1000); nonst_data4.SetValue(IRobotBarSectionNonstdDataValue.I_BSNDV_RECT_B, 2 * _sectionInfo[7] / 1000); //generate correct section properties without overlapping thicknesses nonst_data4.SetValue(IRobotBarSectionNonstdDataValue.I_BSNDV_RECT_T, _sectionInfo[7] / 1000); data4.CalcNonstdGeometry(); _structure.Labels.Store(sec4); nonst_data5.SetValue(IRobotBarSectionNonstdDataValue.I_BSNDV_RECT_H, _sectionInfo[8] / 1000); nonst_data5.SetValue(IRobotBarSectionNonstdDataValue.I_BSNDV_RECT_B, 2 * _sectionInfo[9] / 1000); //generate correct section properties without overlapping thicknesses nonst_data5.SetValue(IRobotBarSectionNonstdDataValue.I_BSNDV_RECT_T, _sectionInfo[9] / 1000); data5.CalcNonstdGeometry(); _structure.Labels.Store(sec5); nonst_data6.SetValue(IRobotBarSectionNonstdDataValue.I_BSNDV_RECT_H, _sectionInfo[10] / 1000); nonst_data6.SetValue(IRobotBarSectionNonstdDataValue.I_BSNDV_RECT_B, 2 * _sectionInfo[11] / 1000); //generate correct section properties without overlapping thicknesses nonst_data6.SetValue(IRobotBarSectionNonstdDataValue.I_BSNDV_RECT_T, _sectionInfo[11] / 1000); data6.CalcNonstdGeometry(); _structure.Labels.Store(sec6); //the values of the cable are already set! _structure.Labels.Store(sec7); } int barId = 5000; for (int i = 0; i < _barInfo.Count; i++) { Console.WriteLine("Now creating bar " + barId.ToString() + "..."); var b = (AnalyticalBar)_barInfo[i]; //find the corresponding points in the nodeList to create the bar //int robStart = 0; //int robEnd = 0; //foreach (var n in _nodeInfo) //{ // if (n.catiaID.Equals(b.CatiaStart)) // { // robStart = n.Id; // } // else if (n.catiaID.Equals(b.CatiaEnd)) // { // robEnd = n.robotID; // } // else // { // continue; // } //} //create the bar _bars.Create(barId, b.Start.Id, b.End.Id); //DON'T CREATE A RELEASE - DIFFICULT TO IMPLEMENT // _bars.Get(barId).SetLabel(IRobotLabelType.I_LT_BAR_RELEASE, "CatiaBarRelease"); if (b.SectionType == SectionType.Tube00) { _bars.Get(barId).SetLabel(IRobotLabelType.I_LT_BAR_SECTION, "CatiaTubeSection_00"); } else if (b.SectionType == SectionType.Tube01) { _bars.Get(barId).SetLabel(IRobotLabelType.I_LT_BAR_SECTION, "CatiaTubeSection_01"); } else if (b.SectionType == SectionType.Tube02) { _bars.Get(barId).SetLabel(IRobotLabelType.I_LT_BAR_SECTION, "CatiaTubeSection_02"); } else if (b.SectionType == SectionType.Plate00) { _bars.Get(barId).SetLabel(IRobotLabelType.I_LT_BAR_SECTION, "CatiaPlateSection_00"); } else if (b.SectionType == SectionType.Plate01) { _bars.Get(barId).SetLabel(IRobotLabelType.I_LT_BAR_SECTION, "CatiaPlateSection_01"); } else if (b.SectionType == SectionType.Plate02) { _bars.Get(barId).SetLabel(IRobotLabelType.I_LT_BAR_SECTION, "CatiaPlateSection_02"); } else if (b.SectionType == SectionType.Cable) { _bars.Get(barId).SetLabel(IRobotLabelType.I_LT_BAR_CABLE, "CatiaCable"); } forDeadLoadsBars.Add(barId); b.Id = barId; //b.RobotStart = robStart; //b.RobotEnd = robEnd; //b.StressAxial = 0.0; barId++; } }