public static void Update_nodes(float[] x, float[] y, float[] z, Model mdl) { for (int i = 0; i < mdl.z.Length; i++) { IRobotNode node = (IRobotNode)robApp.Project.Structure.Nodes.Get(mdl.init_node + i); node.X += mdl.disp_x_cloth[i] * -1; //update z coordinate after first cloth run node.Y += mdl.disp_y_cloth[i] * -1; //update z coordinate after first cloth run node.Z += mdl.disp_z_cloth[i] * -1; //update z coordinate after first cloth run } Robot_call.Refresh(); }
public static bool SetSupports(Frame frame) { robotApp.Interactive = 0; IRobotNode leftSupportnode = (IRobotNode)nodeServer.Get(frame.Supports[0].Position.Id); leftSupportnode.SetLabel(IRobotLabelType.I_LT_SUPPORT, frame.Supports[0].SupportType.ToString()); IRobotNode rightSupportnode = (IRobotNode)nodeServer.Get(frame.Supports[1].Position.Id); rightSupportnode.SetLabel(IRobotLabelType.I_LT_SUPPORT, frame.Supports[1].SupportType.ToString()); robotApp.Interactive = 1; return(true); }
//public static bool SetCases() //{ // robotApp.Interactive = 0; // IRobotSimpleCase deadLoad = caseServer.CreateSimple(caseServer.FreeNumber, "Frame Weight Dead", IRobotCaseNature.I_CN_PERMANENT, IRobotCaseAnalizeType.I_CAT_STATIC_LINEAR); // IRobotSimpleCase coverDaedLoad = caseServer.CreateSimple(caseServer.FreeNumber, "Cover Dead", IRobotCaseNature.I_CN_PERMANENT, IRobotCaseAnalizeType.I_CAT_STATIC_LINEAR); // IRobotSimpleCase liveLoad = caseServer.CreateSimple(caseServer.FreeNumber, "Live", IRobotCaseNature.I_CN_PERMANENT, IRobotCaseAnalizeType.I_CAT_STATIC_LINEAR); // IRobotSimpleCase windLoadLeft = caseServer.CreateSimple(caseServer.FreeNumber, "Wind_left", IRobotCaseNature.I_CN_WIND, IRobotCaseAnalizeType.I_CAT_STATIC_LINEAR); // IRobotSimpleCase windLoadRight = caseServer.CreateSimple(caseServer.FreeNumber, "Wind_right", IRobotCaseNature.I_CN_WIND, IRobotCaseAnalizeType.I_CAT_STATIC_LINEAR); // IRobotSimpleCase tempretureNegative = caseServer.CreateSimple(caseServer.FreeNumber, "Temprature +VE", IRobotCaseNature.I_CN_TEMPERATURE, IRobotCaseAnalizeType.I_CAT_STATIC_LINEAR); // IRobotSimpleCase tempreturePostive = caseServer.CreateSimple(caseServer.FreeNumber, "Temprature -VE", IRobotCaseNature.I_CN_TEMPERATURE, IRobotCaseAnalizeType.I_CAT_STATIC_LINEAR); // IRobotSimpleCase earthQuake = caseServer.CreateSimple(caseServer.FreeNumber, "EarthQuake", IRobotCaseNature.I_CN_SEISMIC, IRobotCaseAnalizeType.I_CAT_DYNAMIC_SEISMIC); // robotApp.Interactive = 1; // //====================== // // live Load = 0.57 // // Shall we Support Snow load or not ? // //Wind load is to be calculated using Bolt Wind calculator // // wind load = q = 2.546 * 10 ^ -5 * v ^ 2 * h ^ 2/7 // //Thermal load is to be calucalted form the eqution , Changes in Unit Stress = E e t ; // // E = 20340 , e = 0.0000117 , t // // Live load = 0.57 // // wind speed = 130 // return true; //} public static bool SetSupports(List <Node> frameNodes) { robotApp.Interactive = 0; IRobotNode leftSupportnode = (IRobotNode)nodeServer.Get(frameNodes[0].Id); leftSupportnode.SetLabel(IRobotLabelType.I_LT_SUPPORT, "Pinned"); IRobotNode rightSupportnode = (IRobotNode)nodeServer.Get(frameNodes[frameNodes.Count - 1].Id); rightSupportnode.SetLabel(IRobotLabelType.I_LT_SUPPORT, "Pinned"); robotApp.Interactive = 1; return(true); }
public static void Get_nodes(Model mdl) { int w = 0; for (int i = mdl.init_node; i <= mdl.last_node; i++) { IRobotNode temp = (IRobotNode)robApp.Project.Structure.Nodes.Get(i); Console.Write(temp.Z); mdl.z[w] = (float)temp.Z; w++; } }
private void CreateNodes() { IRobotLabel sup = _structure.Labels.Create(IRobotLabelType.I_LT_SUPPORT, "CatiaSupport"); IRobotNodeSupportData sup_data = sup.Data as IRobotNodeSupportData; sup_data.SetFixed(IRobotNodeSupportFixingDirection.I_NSFD_UX, 1); sup_data.SetFixed(IRobotNodeSupportFixingDirection.I_NSFD_UY, 1); sup_data.SetFixed(IRobotNodeSupportFixingDirection.I_NSFD_UZ, 1); sup_data.SetFixed(IRobotNodeSupportFixingDirection.I_NSFD_RX, 0); sup_data.SetFixed(IRobotNodeSupportFixingDirection.I_NSFD_RY, 0); sup_data.SetFixed(IRobotNodeSupportFixingDirection.I_NSFD_RZ, 0); _structure.Labels.Store(sup); int nodeId = 100; for (int i = 0; i < _nodeInfo.Count; i++) { Console.WriteLine("Now creating " + nodeId.ToString() + "..."); var n = (AnalyticalNode)_nodeInfo[i]; //create the robot node _nodes.Create(nodeId, n.X, n.Y, n.Z); if (n.IsFixed == true) { Console.WriteLine("Fixing node " + nodeId.ToString() + "..."); IRobotNode node = _nodes.Get(nodeId) as IRobotNode; node.SetLabel(IRobotLabelType.I_LT_NODE_SUPPORT, "CatiaSupport"); } //set the robot node information in the List //to be pushed back into the XML n.Id = nodeId; //the robot node Id //n.displaceX = 0.0; //n.displaceY = 0.0; //n.displaceZ = 0.0; nodeId++; } }
public void CopyData() { button1.Text = "Loading..."; //this.WindowState = FormWindowState.Minimized; //------------------------------------- //Load Cases IRobotCaseCollection robotCaseCollection = robapp.Project.Structure.Cases.GetAll(); int loadCase = 0; int FindCase(string casename) { int number = 1; IRobotCase robotCase = robapp.Project.Structure.Cases.Get(1); for (int i = 0; i < robotCaseCollection.Count; i++) { robotCase = robapp.Project.Structure.Cases.Get(i); if (robotCase != null) { if (robotCase.Name == casename) { number = i; break; } } } loadCase = number; return(number); } //------------------------------------- //Get Number of Bars Selected RobotSelection barSel = robapp.Project.Structure.Selections.Get(IRobotObjectType.I_OT_BAR); //Get All Load Cases RobotSelection casSel = robapp.Project.Structure.Selections.Get(IRobotObjectType.I_OT_CASE); //Get Bar and Node Data IRobotBarServer robotBarServer = robapp.Project.Structure.Bars; IRobotNodeServer inds = robapp.Project.Structure.Nodes; //Get a List of the bars and Setup bar information Struct int[] barSelArray = new int[barSel.Count]; BeamDataStruct[] beamData = new BeamDataStruct[barSelArray.Length]; for (int i = 1; i < barSel.Count + 1; i++) { //Setup bar no. array barSelArray[i - 1] = barSel.Get(i); //Get node information from bar data IRobotBar bar = (IRobotBar)robotBarServer.Get(barSelArray[i - 1]); int startNodeNo = bar.StartNode; int endNodeNo = bar.EndNode; IRobotNode startNode = (IRobotNode)inds.Get(startNodeNo); IRobotNode endNode = (IRobotNode)inds.Get(endNodeNo); //If a Beam, Skip if (startNode.Z == endNode.Z) { continue; } //Which is highest node IRobotNode node = (startNode.Z > endNode.Z) ? startNode : endNode; //Populate beam data from node and bar data. beamData[i - 1].barNo = barSelArray[i - 1]; IRobotBarSectionData sectData = bar.GetLabel(IRobotLabelType.I_LT_BAR_SECTION).Data; double depth = sectData.GetValue(IRobotBarSectionDataValue.I_BSDV_BF); double breath = sectData.GetValue(IRobotBarSectionDataValue.I_BSDV_D); if (depth < breath) { double holder = breath; breath = depth; depth = holder; } depth = depth * 1000; breath = breath * 1000; beamData[i - 1].section = $"C1 {depth} x {breath}"; beamData[i - 1].x = node.X; beamData[i - 1].y = node.Y; beamData[i - 1].z = node.Z; beamData[i - 1].height = bar.Length; IRobotMaterialData concrete = bar.GetLabel(IRobotLabelType.I_LT_MATERIAL).Data; Double concreteS = concrete.RE / 1000000; beamData[i - 1].concreteStrength = concreteS.ToString(); } textBox2.AppendText("\r\nSorting\r\n"); beamData = beamData.OrderBy(x => x.z).ToArray(); beamData = beamData.OrderBy(x => x.y).ToArray(); beamData = beamData.OrderBy(x => x.x).ToArray(); int group = 1; int posInGroup = 0; for (int i = 0; i < beamData.Length; i++) { posInGroup = 0; for (int j = 0; j < beamData.Length; j++) { if (beamData[i].x - beamData[j].x < 0.0001 && beamData[i].y - beamData[j].y < 0.0001 && beamData[i].barNo != beamData[j].barNo) { if (beamData[j].group != 0) { beamData[i].group = beamData[j].group; for (int k = 0; k < beamData.Length; k++) { if (beamData[i].group == beamData[k].group && beamData[i].barNo != beamData[k].barNo) { posInGroup++; } } beamData[i].posInGroup = posInGroup; } else { beamData[i].group = group; group++; } break; } } } void CalculateResults() { textBox2.AppendText($"\r\nStarting calculation: {DateTime.Now.ToString("h:mm:ss tt")}"); RobotExtremeParams robotExtremeParams = robapp.CmpntFactory.Create(IRobotComponentType.I_CT_EXTREME_PARAMS); robapp.Project.Structure.Selections.Get(IRobotObjectType.I_OT_CASE).FromText(FindCase(listBox1.SelectedItem.ToString()).ToString()); robotExtremeParams.Selection.Set(IRobotObjectType.I_OT_CASE, casSel); IRobotBarForceServer robotBarResultServer = robapp.Project.Structure.Results.Bars.Forces; int total = beamData.Length; bool firstLoop = true; string columnsSelected = ""; for (int i = 0; i < beamData.Length; i++) { DateTime startTime = DateTime.Now; textBox2.AppendText($"\r\nStart Calculation {i + 1} / {total} before bar selection: {DateTime.Now.ToString("h:mm:ss tt")}"); robapp.Project.Structure.Selections.Get(IRobotObjectType.I_OT_BAR).FromText(beamData[i].barNo.ToString()); robotExtremeParams.Selection.Set(IRobotObjectType.I_OT_BAR, barSel); //MZ robotExtremeParams.ValueType = IRobotExtremeValueType.I_EVT_FORCE_BAR_MZ; if (Math.Abs(robapp.Project.Structure.Results.Extremes.MaxValue(robotExtremeParams).Value) > Math.Abs(robapp.Project.Structure.Results.Extremes.MinValue(robotExtremeParams).Value)) { beamData[i].mZForceServer = robotBarResultServer.ValueEx(beamData[i].barNo, loadCase, robapp.Project.Structure.Results.Extremes.MaxValue(robotExtremeParams).CaseCmpnt, 1); beamData[i].mZForceServerbtm = robotBarResultServer.ValueEx(beamData[i].barNo, loadCase, robapp.Project.Structure.Results.Extremes.MaxValue(robotExtremeParams).CaseCmpnt, 0); } else { beamData[i].mZForceServer = robotBarResultServer.ValueEx(beamData[i].barNo, loadCase, robapp.Project.Structure.Results.Extremes.MinValue(robotExtremeParams).CaseCmpnt, 1); beamData[i].mZForceServerbtm = robotBarResultServer.ValueEx(beamData[i].barNo, loadCase, robapp.Project.Structure.Results.Extremes.MinValue(robotExtremeParams).CaseCmpnt, 0); } beamData[i].mzValue = Math.Abs(beamData[i].mZForceServer.MZ) > Math.Abs(beamData[i].mZForceServerbtm.MZ) ? beamData[i].mZForceServer.FX : beamData[i].mZForceServerbtm.FX; //MY robotExtremeParams.ValueType = IRobotExtremeValueType.I_EVT_FORCE_BAR_MY; if (Math.Abs(robapp.Project.Structure.Results.Extremes.MaxValue(robotExtremeParams).Value) > Math.Abs(robapp.Project.Structure.Results.Extremes.MinValue(robotExtremeParams).Value)) { beamData[i].mYForceServer = robotBarResultServer.ValueEx(beamData[i].barNo, loadCase, robapp.Project.Structure.Results.Extremes.MaxValue(robotExtremeParams).CaseCmpnt, 1); beamData[i].mYForceServerbtm = robotBarResultServer.ValueEx(beamData[i].barNo, loadCase, robapp.Project.Structure.Results.Extremes.MaxValue(robotExtremeParams).CaseCmpnt, 0); } else { beamData[i].mYForceServer = robotBarResultServer.ValueEx(beamData[i].barNo, loadCase, robapp.Project.Structure.Results.Extremes.MinValue(robotExtremeParams).CaseCmpnt, 1); beamData[i].mYForceServerbtm = robotBarResultServer.ValueEx(beamData[i].barNo, loadCase, robapp.Project.Structure.Results.Extremes.MinValue(robotExtremeParams).CaseCmpnt, 0); } beamData[i].myValue = Math.Abs(beamData[i].mYForceServer.MY) > Math.Abs(beamData[i].mYForceServerbtm.MY) ? beamData[i].mYForceServer.FX : beamData[i].mYForceServerbtm.FX; //FX robotExtremeParams.ValueType = IRobotExtremeValueType.I_EVT_FORCE_BAR_FX; if (Math.Abs(robapp.Project.Structure.Results.Extremes.MaxValue(robotExtremeParams).Value) > Math.Abs(robapp.Project.Structure.Results.Extremes.MinValue(robotExtremeParams).Value)) { beamData[i].fXForceServer = robotBarResultServer.ValueEx(beamData[i].barNo, loadCase, robapp.Project.Structure.Results.Extremes.MaxValue(robotExtremeParams).CaseCmpnt, 1); beamData[i].fXForceServerbtm = robotBarResultServer.ValueEx(beamData[i].barNo, loadCase, robapp.Project.Structure.Results.Extremes.MaxValue(robotExtremeParams).CaseCmpnt, 0); } else { beamData[i].fXForceServer = robotBarResultServer.ValueEx(beamData[i].barNo, loadCase, robapp.Project.Structure.Results.Extremes.MinValue(robotExtremeParams).CaseCmpnt, 1); beamData[i].fXForceServerbtm = robotBarResultServer.ValueEx(beamData[i].barNo, loadCase, robapp.Project.Structure.Results.Extremes.MinValue(robotExtremeParams).CaseCmpnt, 0); } beamData[i].fxValue = Math.Abs(beamData[i].fXForceServer.FX) > Math.Abs(beamData[i].fXForceServerbtm.FX) ? beamData[i].fXForceServer.FX : beamData[i].fXForceServerbtm.FX; double totalTime = (DateTime.Now - startTime).TotalSeconds; textBox2.AppendText($"\r\nEnd Calculation {i + 1} / {total} {DateTime.Now.ToString("h:mm:ss tt")} \r\nTime taken: {totalTime}"); if (firstLoop) { textBox2.AppendText($"\r\nEstimated finish time: {DateTime.Now.AddSeconds(total * totalTime).ToString("h:mm:ss tt")}"); firstLoop = false; } columnsSelected += $"{beamData[i].barNo.ToString()} "; } textBox2.AppendText($"\r\ncolumns selected {columnsSelected}"); robapp.Project.Structure.Selections.Get(IRobotObjectType.I_OT_BAR).FromText(columnsSelected); } int maxCol = 1; void WriteResults() { int column = 1; int currentGroup = 0; for (int i = 0; i < beamData.Length; i++) { if (beamData[i].group == currentGroup) { column = beamData[i].posInGroup; if (column >= maxCol) { maxCol = column; } } else { currentGroup++; column = 0; } int row = currentGroup + 2; int columnPos = beamData[i].posInGroup + 1; WriteCell(row, 0, columnPos.ToString()); WriteCell(row, 1 + 22 * column, beamData[i].section.ToString()); WriteCell(row, 2 + 22 * column, beamData[i].barNo.ToString()); WriteCell(row, 3 + 22 * column, beamData[i].concreteStrength.ToString()); WriteCell(row, 4 + 22 * column, beamData[i].group.ToString()); WriteCell(row, 5 + 22 * column, beamData[i].posInGroup.ToString()); WriteCell(row, 6 + 22 * column, beamData[i].height.ToString()); WriteCell(row, 7 + 22 * column, (beamData[i].fxValue / 1000).ToString()); WriteCell(row, 8 + 22 * column, (beamData[i].fXForceServer.MY / 1000).ToString()); WriteCell(row, 9 + 22 * column, (beamData[i].fXForceServer.MZ / 1000).ToString()); WriteCell(row, 10 + 22 * column, (beamData[i].fXForceServerbtm.MY / 1000).ToString()); WriteCell(row, 11 + 22 * column, (beamData[i].fXForceServerbtm.MZ / 1000).ToString()); WriteCell(row, 12 + 22 * column, (beamData[i].mzValue / 1000).ToString()); WriteCell(row, 13 + 22 * column, (beamData[i].mZForceServer.MY / 1000).ToString()); WriteCell(row, 14 + 22 * column, (beamData[i].mZForceServer.MZ / 1000).ToString()); WriteCell(row, 15 + 22 * column, (beamData[i].mZForceServerbtm.MY / 1000).ToString()); WriteCell(row, 16 + 22 * column, (beamData[i].mZForceServerbtm.MZ / 1000).ToString()); WriteCell(row, 17 + 22 * column, (beamData[i].myValue / 1000).ToString()); WriteCell(row, 18 + 22 * column, (beamData[i].mYForceServer.MY / 1000).ToString()); WriteCell(row, 19 + 22 * column, (beamData[i].mYForceServer.MZ / 1000).ToString()); WriteCell(row, 20 + 22 * column, (beamData[i].mYForceServerbtm.MY / 1000).ToString()); WriteCell(row, 21 + 22 * column, (beamData[i].mYForceServerbtm.MZ / 1000).ToString()); } WriteCell(0, 0, currentGroup.ToString()); } void PopulateHeaders() { for (int i = 0; i <= maxCol; i++) { //Headers WriteCell(1, 1 + 22 * i, "Cross Section"); WriteCell(1, 2 + 22 * i, "Bar No."); WriteCell(1, 3 + 22 * i, "Concrete Strength"); WriteCell(1, 4 + 22 * i, "Group"); WriteCell(1, 5 + 22 * i, "Pos In Group"); WriteCell(1, 6 + 22 * i, "Length"); //FZ Max WriteCell(1, 7 + 22 * i, "Fx (Max) [kN]"); WriteCell(1, 8 + 22 * i, "My (Top) [kNm]"); WriteCell(1, 9 + 22 * i, "Mz (Top) [kNm]"); WriteCell(1, 10 + 22 * i, "My (Btm) [kNm]"); WriteCell(1, 11 + 22 * i, "Mz (Btm) [kNm]"); //MX Max WriteCell(1, 12 + 22 * i, "Fx (Max) [kN]"); WriteCell(1, 13 + 22 * i, "My (Top) [kNm]"); WriteCell(1, 14 + 22 * i, "Mz (Top) [kNm]"); WriteCell(1, 15 + 22 * i, "My (Btm) [kNm]"); WriteCell(1, 16 + 22 * i, "Mz (Btm) [kNm]"); //MY Max WriteCell(1, 17 + 22 * i, "Fx (Max) [kN])"); WriteCell(1, 18 + 22 * i, "My (Top) [kNm]"); WriteCell(1, 19 + 22 * i, "Mz (Top) [kNm]"); WriteCell(1, 20 + 22 * i, "My (Btm) [kNm]"); WriteCell(1, 21 + 22 * i, "Mz (Btm) [kNm]"); //Headers WriteCell(0, 9 + 22 * i, "Fx (Max)"); WriteCell(0, 14 + 22 * i, "Mz (Max)"); WriteCell(0, 19 + 22 * i, "My (Max)"); } } WriteData(); CalculateResults(); WriteResults(); PopulateHeaders(); SaveExcel(); CloseExcel(); button1.Text = "Start"; textBox2.AppendText("\r\nDone, view your documents for the file named 'Results for bars ~date~', you may close this window or select more columns and press 'Start'."); robapp = null; this.WindowState = FormWindowState.Normal; }
/// <summary> /// Extract the position of a Robot Node as a Nucleus Vector /// </summary> /// <param name="node"></param> /// <returns></returns> public static Vector PositionOf(IRobotNode node) { return(new Vector(node.X, node.Y, node.Z)); }
/// <summary> /// Convert a Robot node to a Nucleus one /// </summary> /// <param name="node"></param> /// <returns></returns> public static Node Convert(IRobotNode node) { Node result = new Node(node.X, node.Y, node.Z); return(result); }
}//loadProfileDatabase //Divide columns into a number of bars //Reference: https://forums.autodesk.com/t5/robot-structural-analysis-forum/api-divide-bars/m-p/4422193#M16921 public void divideColumns(int divisionNumber, string section) { int firstIsolatedNode = iRobotApp.Project.Structure.Nodes.FreeNumber; //First new created node int freeNodeNumber = firstIsolatedNode; //Add columns to the selection foreach (Bar bar in bars) { if (bar.type == MemberType.Column) { IRobotBar robotBar = (RobotBar)iRobotApp.Project.Structure.Bars.Get(bar.id); IRobotNode startNode = (RobotNode)iRobotApp.Project.Structure.Nodes.Get(bar.startNode.id); IRobotNode endNode = (RobotNode)iRobotApp.Project.Structure.Nodes.Get(bar.endNode.id); //Console.WriteLine("freeNodeNumber: " + freeNodeNumber); //Bar vector double vx, vy, vz, vl; vx = endNode.X - startNode.X; vy = endNode.Y - startNode.Y; vz = endNode.Z - startNode.Z; //Vector length vl = Math.Sqrt(Math.Pow(vx, 2) + Math.Pow(vy, 2) + Math.Pow(vz, 2)); //Normalization vx /= vl; vy /= vl; vz /= vl; //distance between nodes double distance = vl / divisionNumber; //Adding new nodes for (int j = 0; j < divisionNumber - 1; j++) { //Add to the list of nodes //Add a new node Node node = new Node(freeNodeNumber, startNode.X + (j + 1) * vx * distance, startNode.Y + (j + 1) * vy * distance, startNode.Z + (j + 1) * vz * distance); //Console.Write("startNode.X = " + startNode.X); //Console.Write(" startNode.Y = " + startNode.Y); //Console.WriteLine(" startNode.Z = " + startNode.Z); //Console.WriteLine("vx: " + vx + " vy: " + vy + " vz: " + vz + " vl: " + vl); //Console.WriteLine("Node id: " + node.id + " x: " + node.xCoord + " y: " + node.yCoord + " z: " + node.zCoord); nodes.Add(node); //Add a node to the structure iRobotApp.Project.Structure.Nodes.Create(freeNodeNumber, node.xCoord, node.yCoord, node.zCoord); freeNodeNumber++; } } } //Creating aditional bars int numberOfBars = bars.Count + 1; int barIndex = numberOfBars; //Console.WriteLine("Number of bars: " + numberOfBars); int index = firstIsolatedNode; //Console.WriteLine("firstIsolatedNode: " + index); for (int i = 0; i < (divisionNumber - 1); i++) { //Finding the nodes for a line of bars IRobotNode iNode1 = (RobotNode)iRobotApp.Project.Structure.Nodes.Get(index); //Console.WriteLine("Node 1 - " + iNode1.Number); IRobotNode iNode2 = (RobotNode)iRobotApp.Project.Structure.Nodes.Get((index + 2)); //Console.WriteLine("Node 2 - " + iNode2.Number); IRobotNode iNode3 = (RobotNode)iRobotApp.Project.Structure.Nodes.Get((index + 4)); //Console.WriteLine("Node 3 - " + iNode3.Number); IRobotNode iNode4 = (RobotNode)iRobotApp.Project.Structure.Nodes.Get((index + 6)); //Console.WriteLine("Node 4 - " + iNode4.Number); Node node1 = new Node(iNode1.Number, iNode1.X, iNode1.Y, iNode1.Z); nodes.Add(node1); Node node2 = new Node(iNode2.Number, iNode2.X, iNode2.Y, iNode2.Z); nodes.Add(node2); Node node3 = new Node(iNode3.Number, iNode3.X, iNode3.Y, iNode3.Z); nodes.Add(node3); Node node4 = new Node(iNode4.Number, iNode4.X, iNode4.Y, iNode4.Z); nodes.Add(node4); barIndex += i; Bar bar1 = new Bar(barIndex, node1, node2, MemberType.Bar, section); bars.Add(bar1); //Console.WriteLine("Bar id: " + bar1.id + ", first node id: " + bar1.startNode.id + ", last node id: " + bar1.endNode.id); barIndex += 1; Bar bar2 = new Bar(barIndex, node1, node3, MemberType.Bar, section); bars.Add(bar2); //Console.WriteLine("Bar id: " + bar2.id + ", first node id: " + bar2.startNode.id + ", last node id: " + bar2.endNode.id); barIndex += 2; Bar bar3 = new Bar(barIndex, node2, node4, MemberType.Bar, section); //Console.WriteLine("Bar id: " + bar3.id + ", first node id: " + bar3.startNode.id + ", last node id: " + bar3.endNode.id); bars.Add(bar3); barIndex += 3; Bar bar4 = new Bar(barIndex, node3, node4, MemberType.Bar, section); bars.Add(bar4); //Console.WriteLine("Bar id: " + bar4.id + ", first node id: " + bar4.startNode.id + ", last node id: " + bar4.endNode.id); index += 1; } index += 6; barIndex += 1; for (int i = 0; i < (divisionNumber - 1); i++) { //Finding the nodes for a line of bars IRobotNode iNode1 = (RobotNode)iRobotApp.Project.Structure.Nodes.Get(index); //Console.WriteLine("Node 1 - " + iNode1.Number); IRobotNode iNode2 = (RobotNode)iRobotApp.Project.Structure.Nodes.Get((index + 2)); //Console.WriteLine("Node 2 - " + iNode2.Number); IRobotNode iNode3 = (RobotNode)iRobotApp.Project.Structure.Nodes.Get((index + 4)); //Console.WriteLine("Node 3 - " + iNode3.Number); IRobotNode iNode4 = (RobotNode)iRobotApp.Project.Structure.Nodes.Get((index + 6)); //Console.WriteLine("Node 4 - " + iNode4.Number); Node node1 = new Node(iNode1.Number, iNode1.X, iNode1.Y, iNode1.Z); nodes.Add(node1); Node node2 = new Node(iNode2.Number, iNode2.X, iNode2.Y, iNode2.Z); nodes.Add(node2); Node node3 = new Node(iNode3.Number, iNode3.X, iNode3.Y, iNode3.Z); nodes.Add(node3); Node node4 = new Node(iNode4.Number, iNode4.X, iNode4.Y, iNode4.Z); nodes.Add(node4); barIndex += i; Bar bar1 = new Bar(barIndex, node1, node2, MemberType.Bar, section); bars.Add(bar1); //Console.WriteLine("Bar id: " + bar1.id + ", first node id: " + bar1.startNode.id + ", last node id: " + bar1.endNode.id); barIndex += 1; Bar bar2 = new Bar(barIndex, node1, node3, MemberType.Bar, section); bars.Add(bar2); //Console.WriteLine("Bar id: " + bar2.id + ", first node id: " + bar2.startNode.id + ", last node id: " + bar2.endNode.id); barIndex += 2; Bar bar3 = new Bar(barIndex, node2, node4, MemberType.Bar, section); //Console.WriteLine("Bar id: " + bar3.id + ", first node id: " + bar3.startNode.id + ", last node id: " + bar3.endNode.id); bars.Add(bar3); barIndex += 3; Bar bar4 = new Bar(barIndex, node3, node4, MemberType.Bar, section); bars.Add(bar4); //Console.WriteLine("Bar id: " + bar4.id + ", first node id: " + bar4.startNode.id + ", last node id: " + bar4.endNode.id); index += 1; } addRobotBars(numberOfBars - 1, null, null, null, section); }//divideColumns
/// <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(); }
// 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> /// Add a new Node entry to this mapping table /// </summary> /// <param name="fbNode"></param> /// <param name="rNode"></param> public void Add(Node fbNode, IRobotNode rNode) { Add(NodeCategory, fbNode.GUID, rNode.Number.ToString()); }
/// <summary> /// Get the Nucleus node, if any, mapped to the ID number of the specified robot node /// </summary> /// <param name="robotID"></param> /// <param name="model"></param> /// <returns></returns> public Node GetMappedModelNode(IRobotNode node, Model.Model model) { return(GetMappedModelNode(node.Number, model)); }
/// <summary> /// Set the position of this node using a Vector /// </summary> /// <param name="node"></param> /// <param name="position"></param> public static void SetPosition(this IRobotNode node, Vector position) { node.X = position.X; node.Y = position.Y; node.Z = position.Z; }
private void CreatePlates(double liveLoad, List <int> forLiveLoads, double windLoad, List <int> forWindLoads, double buildingLoad, List <int> forBuildingLoads, List <int> forDeadLoadsSlabs, IRobotSimpleCase ll, IRobotSimpleCase wl, IRobotSimpleCase bl, double fatManLoad, IRobotSimpleCase dl, List <int> forDeadLoadsBars) { #region material info //create the slab material // string materialName = "Catia_material_slab"; // IRobotLabel Label = _structure.Labels.Create(IRobotLabelType.I_LT_MATERIAL, materialName); // RobotMaterialData Material = Label.Data as RobotMaterialData; // Material.Type = IRobotMaterialType.I_MT_CONCRETE; // Material.E = 30000000000; // Material.NU = 0.16; // Material.RO = 25000; // Material.Kirchoff = Material.E / (2*(1 + Material.NU)); // _project.Structure.Labels.Store(Label); //create the panel type string catSlabSectionName = "Catia_Slab"; IRobotLabel Label = _structure.Labels.Create(IRobotLabelType.I_LT_PANEL_THICKNESS, catSlabSectionName); RobotThicknessData thickness = Label.Data as RobotThicknessData; // thickness.MaterialName = materialName; thickness.MaterialName = "CONCR"; thickness.ThicknessType = IRobotThicknessType.I_TT_HOMOGENEOUS; RobotThicknessHomoData thicknessData = thickness.Data as RobotThicknessHomoData; if (_plateInfo.Count != 0) { thicknessData.ThickConst = _plateInfo[0].Thickness / 1000; //test one panel for thickness } else { thicknessData.ThickConst = .02; } _project.Structure.Labels.Store(Label); //create the panel material // string materialName = "Catia_material_panel"; // Label = _structure.Labels.Create(IRobotLabelType.I_LT_MATERIAL, materialName); // Material = Label.Data as RobotMaterialData; // Material.Type = IRobotMaterialType.I_MT_CONCRETE; // Material.Type = IRobotMaterialType.I_MT_ALUMINIUM; // Material.E = 69000000000; // Material.NU = 0.16; //the poisson ratio // Material.RO = 25000; //the mass // Material.Kirchoff = Material.E / (2*(1 + Material.NU)); // _project.Structure.Labels.Store(Label); string catPanelSectionName = "Catia_Panel"; Label = _structure.Labels.Create(IRobotLabelType.I_LT_PANEL_THICKNESS, catPanelSectionName); thickness = Label.Data as RobotThicknessData; // thickness.MaterialName = materialName; thickness.MaterialName = "ALUM"; thickness.ThicknessType = IRobotThicknessType.I_TT_HOMOGENEOUS; thicknessData = thickness.Data as RobotThicknessHomoData; thicknessData.ThickConst = 0.003175; //a 1/8" thick aluminum panel, we'll need to use a single finite element _project.Structure.Labels.Store(Label); string catShearPanelName = "Catia_Shear"; Label = _structure.Labels.Create(IRobotLabelType.I_LT_PANEL_THICKNESS, catShearPanelName); thickness = Label.Data as RobotThicknessData; thickness.MaterialName = "CONCR"; thickness.ThicknessType = IRobotThicknessType.I_TT_HOMOGENEOUS; thicknessData = thickness.Data as RobotThicknessHomoData; thicknessData.ThickConst = 0.3; //a 1/8" thick aluminum panel, we'll need to use a single finite element _project.Structure.Labels.Store(Label); #endregion int plateId = 10000; for (int i = 0; i < _plateInfo.Count; i++) { Console.WriteLine("Now creating plate " + plateId.ToString() + "..."); List <int> robotNodes = new List <int>(); var p = (AnalyticalPlate)_plateInfo[i]; //the plate to create //at this point we know the CATIA nodes and the robot nodes //but the robot node list for each plate is empty //find the robot node that corresponds to each catia node in the list //fill up the corresponding robot id list //foreach (string catIndex in p.CatiaPoints) //{ // foreach (Node n in _nodeInfo) // { // //if the node id equals that in the catia points list // if (n.catiaID.Equals(catIndex)) // { // robotNodes.Add(n.robotID); //add the int robot id to the other list // } // else // { // continue; //continue; // } // } //} p.Nodes = robotNodes; //change out the robotNodes list on the object //the robot point array to hold all the pts RobotPointsArray pts = new RobotPointsArrayClass(); pts.SetSize(p.Nodes.Count); int ptIndex = 1; //fill up the points array foreach (int rId in p.Nodes) { IRobotNode robNode = _structure.Nodes.Get(rId) as IRobotNode; pts.Set(ptIndex, robNode.X, robNode.Y, robNode.Z); //MessageBox.Show(robNode.X.ToString()); ptIndex++; } //int plateId = _structure.Objects.FreeNumber; _project.Structure.Objects.CreateContour(plateId, pts); IRobotObjObject obj = _structure.Objects.Get(plateId) as IRobotObjObject; obj.Main.Attribs.Meshed = 1; if (p.PlateType == PlateType.Slab) { obj.SetLabel(IRobotLabelType.I_LT_PANEL_THICKNESS, catSlabSectionName); obj.SetLabel(IRobotLabelType.I_LT_PANEL_REINFORCEMENT, "Panel"); } else if (p.PlateType == PlateType.Panel) { obj.SetLabel(IRobotLabelType.I_LT_PANEL_THICKNESS, catPanelSectionName); } else if (p.PlateType == PlateType.Shear) { obj.SetLabel(IRobotLabelType.I_LT_PANEL_THICKNESS, catShearPanelName); obj.SetLabel(IRobotLabelType.I_LT_PANEL_REINFORCEMENT, "Wall"); } else { obj.SetLabel(IRobotLabelType.I_LT_PANEL_THICKNESS, catPanelSectionName); } obj.Initialize(); obj.Update(); //create some loads //if the live load has a value // if(p.PlateType == PlateType.slab) if (p.LiveLoad > 0.0) { Console.WriteLine("Now creating live load on slab " + plateId.ToString() + "..."); liveLoad = p.LiveLoad; forLiveLoads.Add(plateId); } //if the wind load has a value // else if (p.PlateType == PlateType.panel) if (p.WindLoad > 0.0) { Console.WriteLine("Now creating wind load on panel " + plateId.ToString() + "..."); windLoad = p.WindLoad; forWindLoads.Add(plateId); } if (p.BuildingLoad > 0.0) { Console.WriteLine("Now creating building load on panel " + plateId.ToString() + "..."); buildingLoad = p.BuildingLoad; forBuildingLoads.Add(plateId); } forDeadLoadsSlabs.Add(plateId); //all p.Id = plateId; //set the plateId on the object plateId++; } IRobotLoadRecord rec = null; if (forLiveLoads.Count > 0) { //add the live loads on all panels rec = ll.Records.Get(1); rec.Objects.FromText(forLiveLoads[0].ToString() + "to" + forLiveLoads[forLiveLoads.Count - 1].ToString()); rec.SetValue(2, -liveLoad); rec.SetValue(11, 0); } if (forWindLoads.Count > 0) { //add the forces on the wind panels rec = wl.Records.Get(1); rec.Objects.FromText(forWindLoads[0].ToString() + "to" + forWindLoads[forWindLoads.Count - 1].ToString()); rec.SetValue(0, _windx * windLoad); //the X value rec.SetValue(1, _windy * windLoad); //the Y value rec.SetValue(2, _windz * windLoad); // the Z value // rec.SetValue(11, 1); //this sets it use the "local" normal for the wind direction rec.SetValue(11, 0); //this is the default - loads act in the global direction //add the uplift on the wind panels // rec = wl_uplift.Records.Get(1); // rec.Objects.FromText(forWindLoads[0].ToString() +"to"+forWindLoads[forWindLoads.Count-1].ToString()); // rec.SetValue(2, -windLoad); // rec.SetValue(11,1); } if (forBuildingLoads.Count > 0) { rec = bl.Records.Get(1); rec.Objects.FromText(forBuildingLoads[0].ToString() + "to" + forBuildingLoads[forBuildingLoads.Count - 1].ToString()); rec.SetValue(2, -buildingLoad); rec.SetValue(11, 0); } //create a randomly placed live load on the structure //the fat man load IRobotCollection nodes = _nodes.GetAll(); Random r = new Random(); int randPoint = r.Next((nodes.Get(1) as IRobotNode).Number, (nodes.Get(nodes.Count) as IRobotNode).Number); // Debug.WriteLine(randPoint); rec = ll.Records.Get(2); rec.SetValue(2, -fatManLoad); rec.Objects.FromText(randPoint.ToString()); //set the dead loads for the structure rec = dl.Records.Get(1); //add dead loads to bars if (forDeadLoadsBars.Count > 0 && forDeadLoadsSlabs.Count == 0) { rec.Objects.FromText(forDeadLoadsBars[0].ToString() + "to" + forDeadLoadsBars[forDeadLoadsBars.Count - 1].ToString()); } //add dead loads to bars and slabs else if (forDeadLoadsBars.Count > 0 && forDeadLoadsSlabs.Count > 0) { rec.Objects.FromText(forDeadLoadsBars[0].ToString() + "to" + forDeadLoadsBars[forDeadLoadsBars.Count - 1].ToString() + " " + forDeadLoadsSlabs[0].ToString() + "to" + forDeadLoadsSlabs[forDeadLoadsSlabs.Count - 1].ToString()); } //add dead loads to slabs only else if (forDeadLoadsBars.Count == 0 && forDeadLoadsSlabs.Count > 0) { rec.Objects.FromText(forDeadLoadsSlabs[0].ToString() + "to" + forDeadLoadsSlabs[forDeadLoadsSlabs.Count - 1].ToString()); } rec.SetValue(2, -1); //set the z value // Console.WriteLine("Waiting for load application..."); // System.Threading.Thread.Sleep(10000); }