//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 void Analyze() { //select all the finite element stuff RobotSelection allFE = _structure.Selections.CreateFull(IRobotObjectType.I_OT_FINITE_ELEMENT); //get the finite element server IRobotFiniteElementServer fe_server = _structure.FiniteElems; //delete the finite element meshes fe_server.DeleteMany(allFE); //consolidate finite elements with a coefficient of one for panels to convex boundaries //so two triangle become a square... //fe_server.MeshConsolidate(1.0, allFE, false); IRobotMeshParams meshParams = _project.Preferences.MeshParams; meshParams.MeshType = IRobotMeshType.I_MT_NORMAL; meshParams.SurfaceParams.Generation.Division1 = 0; meshParams.SurfaceParams.Generation.Division2 = 0; fe_server.Update(); fe_server.MeshConcentrate(IRobotMeshRefinementType.I_MRT_SIMPLE, allFE, false); _project.CalcEngine.AnalysisParams.IgnoreWarnings = true; _project.CalcEngine.AutoGenerateModel = true; // _project.CalcEngine.GenerateModel(); int calcResult = _project.CalcEngine.Calculate(); if (calcResult != 0) { Console.WriteLine("Model analyzed successfully..."); //System.Threading.Thread.Sleep(2000); } else if (calcResult == 0) { throw new Exception("Robot model could not be analyzed."); //System.Threading.Thread.Sleep(2000); } //Console.WriteLine("Saving model with analysis results..."); //_project.SaveAs(m_robotPath); //Console.WriteLine("Robot project saved to " + m_robotPath + "..."); //IRobotPrintEngine printEngine = _project.PrintEngine; //printEngine.AddTemplateToReport("Results"); //printEngine.SaveReportToFile(currDirectory + "\\" + fileName + ".txt", IRobotOutputFileFormat.I_OFF_TEXT); //InitializeResultsServers(); //CheckDeflections(); //CheckStresses(); //WriteCheckDataToOutputFile(currDirectory, fileName); }
public static void AddBar(RobotStructure structureRSA, RobotNode node1, RobotNode node2, IRobotLabel labelSect) { int num1 = node1.Number; int num2 = node2.Number; RobotBarServer barsRSA = structureRSA.Bars; int freeNum = barsRSA.FreeNumber; barsRSA.Create(freeNum, num1, num2); RobotSelection selection = structureRSA.Selections.Create(IRobotObjectType.I_OT_BAR); selection.FromText(freeNum.ToString()); barsRSA.SetLabel(selection, IRobotLabelType.I_LT_BAR_SECTION, labelSect.Name); }
private void ButtonGetCoords_Click(object sender, EventArgs e) { if (!IsRobotActive()) { return; } selection = structure.Selections.Get(IRobotObjectType.I_OT_NODE); int nodeNumber; string coordString; if (selection.Count == 0) { ErrorDialog("No nodes have been selected", "ERROR: No selection"); return; } try { // If Relative to Node No. is selected, fetch coordinates for // the node number which has been input, otherwise return the // coords for the first node in the selection. if (radioRelativeNode.Checked) { nodeNumber = helpers.ValidateNodeID(coordInput.Text); } else { nodeNumber = selection.Get(1); } coordString = ReturnCoordString(nodeNumber); } catch (ArgumentOutOfRangeException) { ErrorDialog("Node does not exist", "ERROR: Node Not Found"); return; } catch (ArgumentException) { ErrorDialog("Invalid node number input", "ERROR: Invalid Node Input"); return; } MessageBox.Show(coordString); }
public void test() { RobotApplication appRSA = new RobotApplication(); getMaterialNameListRSA(appRSA); getBarSectionNamesRSA(appRSA); RobotStructure structureRSA = appRSA.Project.Structure; RobotBarServer barsRSA = structureRSA.Bars; RobotNodeServer nodesRSA = structureRSA.Nodes; RobotObjObjectServer objRSA = structureRSA.Objects; RobotLabelServer labelsRSA = appRSA.Project.Structure.Labels; //Определение выборок выделенных в модели объектов RobotSelection barSel = structureRSA.Selections.Get(IRobotObjectType.I_OT_BAR); RobotSelection plateSel = structureRSA.Selections.Get(IRobotObjectType.I_OT_PANEL); RobotSelection holesSel = structureRSA.Selections.Get(IRobotObjectType.I_OT_GEOMETRY); RobotBarCollection barsMany = (RobotBarCollection)barsRSA.GetMany(barSel); RobotObjObjectCollection platesMany = (RobotObjObjectCollection)objRSA.GetMany(plateSel); IRobotBar barRSA = barsMany.Get(3); IRobotObjObject plate = platesMany.Get(1); IRobotLabel labelPlate = plate.GetLabel(IRobotLabelType.I_LT_PANEL_THICKNESS); RobotGeoPoint3DCollection defPoints = (RobotGeoPoint3DCollection)plate.Main.DefPoints; RobotGeoPoint3D pt1 = defPoints.Get(1); RobotGeoPoint3D pt2 = defPoints.Get(2); RobotGeoPoint3D pt3 = defPoints.Get(defPoints.Count); //IRobotGeoContour geoContour=(IRobotGeoContour)plate.Main.Geometry; //IRobotGeoObject geoObj=plate.Main.Geometry; IRobotLabel labelBar = barRSA.GetLabel(IRobotLabelType.I_LT_BAR_SECTION); RobotBarSectionData data = labelBar.Data; RobotBarSectionConcreteData cData = data.Concrete; double b = cData.GetValue(IRobotBarSectionConcreteDataValue.I_BSCDV_COL_B); double h = cData.GetValue(IRobotBarSectionConcreteDataValue.I_BSCDV_COL_H); double l1 = cData.GetValue(IRobotBarSectionConcreteDataValue.I_BSCDV_COL_L1); double l2 = cData.GetValue(IRobotBarSectionConcreteDataValue.I_BSCDV_COL_L2); double h1 = cData.GetValue(IRobotBarSectionConcreteDataValue.I_BSCDV_COL_H1); double h2 = cData.GetValue(IRobotBarSectionConcreteDataValue.I_BSCDV_COL_H2); double de = cData.GetValue(IRobotBarSectionConcreteDataValue.I_BSCDV_COL_DE); double alfa = barRSA.Gamma; }
public static bool SetBeamSections(Frame frame) { robotApp.Interactive = 0; IRobotLabel builtUpSectionLabel = labelServer.Create(IRobotLabelType.I_LT_BAR_SECTION, "Hndz - Tapered"); RobotBarSectionData builtUpsectionData = builtUpSectionLabel.Data; builtUpsectionData.Type = IRobotBarSectionType.I_BST_NS_II; builtUpsectionData.ShapeType = IRobotBarSectionShapeType.I_BSST_USER_I_MONOSYM; RobotBarSectionNonstdData builtUpsectionDataNonS = builtUpsectionData.CreateNonstd(1); builtUpsectionDataNonS.SetValue(IRobotBarSectionNonstdDataValue.I_BSNDV_II_B1, frame.Beams[0].BeamSectionAtStartNode.B1); builtUpsectionDataNonS.SetValue(IRobotBarSectionNonstdDataValue.I_BSNDV_II_B2, frame.Beams[0].BeamSectionAtStartNode.B2); builtUpsectionDataNonS.SetValue(IRobotBarSectionNonstdDataValue.I_BSNDV_II_H, frame.Beams[0].BeamSectionAtStartNode.Height); builtUpsectionDataNonS.SetValue(IRobotBarSectionNonstdDataValue.I_BSNDV_II_TF1, frame.Beams[0].BeamSectionAtStartNode.TF1); builtUpsectionDataNonS.SetValue(IRobotBarSectionNonstdDataValue.I_BSNDV_II_TF2, frame.Beams[0].BeamSectionAtStartNode.TF2); builtUpsectionDataNonS.SetValue(IRobotBarSectionNonstdDataValue.I_BSNDV_II_TW, frame.Beams[0].BeamSectionAtStartNode.Tw); builtUpsectionDataNonS = builtUpsectionData.CreateNonstd(0); builtUpsectionDataNonS.SetValue(IRobotBarSectionNonstdDataValue.I_BSNDV_II_B1, frame.Beams[0].BeamSectionATEndNode.B1); builtUpsectionDataNonS.SetValue(IRobotBarSectionNonstdDataValue.I_BSNDV_II_B2, frame.Beams[0].BeamSectionATEndNode.B2); builtUpsectionDataNonS.SetValue(IRobotBarSectionNonstdDataValue.I_BSNDV_II_H, frame.Beams[0].BeamSectionATEndNode.Height); builtUpsectionDataNonS.SetValue(IRobotBarSectionNonstdDataValue.I_BSNDV_II_TF1, frame.Beams[0].BeamSectionATEndNode.TF1); builtUpsectionDataNonS.SetValue(IRobotBarSectionNonstdDataValue.I_BSNDV_II_TF2, frame.Beams[0].BeamSectionATEndNode.TF2); builtUpsectionDataNonS.SetValue(IRobotBarSectionNonstdDataValue.I_BSNDV_II_TW, frame.Beams[0].BeamSectionATEndNode.Tw); builtUpsectionData.CalcNonstdGeometry(); labelServer.Store(builtUpSectionLabel); RobotSelection Selection = robotApp.Project.Structure.Selections.Create(IRobotObjectType.I_OT_BAR); Selection.AddOne(frame.Beams[0].Id); Selection.AddOne(frame.Beams[1].Id); barServer.SetLabel(Selection, IRobotLabelType.I_LT_BAR_SECTION, builtUpSectionLabel.Name); //barServer.SetLabel(RightColumn, IRobotLabelType.I_LT_BAR_SECTION, builtUpSectionLabel.Name); 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
static void Main(string[] args) { Console.WriteLine("Starting Robot application..."); //Cria um novo objeto da aplicação Robot IRobotApplication robApp = new RobotApplicationClass(); //Se a aplicaçao não estiver visivel, torna o robot visivel para permitir iteracao if (robApp.Visible == 0) { robApp.Interactive = 1; robApp.Visible = 1; } Console.WriteLine("Creating concrete project..."); //Cria o projeto da viga de concreto robApp.Project.New(IRobotProjectType.I_PT_SHELL); Console.WriteLine("Executing project settings..."); //Configuracao das preferencias RobotProjectPreferences projectPrefs = robApp.Project.Preferences; //Configuracoes do codigo de verificacao da estrutura de concreto projectPrefs.SetActiveCode(IRobotCodeType.I_CT_RC_THEORETICAL_REINF, "BAEL 91"); //Configuracao das preferencias de malha RobotMeshParams meshParams = projectPrefs.MeshParams; meshParams.SurfaceParams.Method.Method = IRobotMeshMethodType.I_MMT_DELAUNAY; meshParams.SurfaceParams.Generation.Type = IRobotMeshGenerationType.I_MGT_ELEMENT_SIZE; meshParams.SurfaceParams.Generation.ElementSize = 0.5; meshParams.SurfaceParams.Delaunay.Type = IRobotMeshDelaunayType.I_MDT_DELAUNAY; //Geração da estrutura Console.WriteLine("Generating structure"); IRobotStructure str = robApp.Project.Structure; Console.WriteLine("Generating nodes..."); str.Nodes.Create(1, 0, 0, 0); str.Nodes.Create(2, 3, 0, 0); str.Nodes.Create(3, 3, 3, 0); str.Nodes.Create(4, 0, 3, 0); str.Nodes.Create(5, 0, 0, 4); str.Nodes.Create(6, 3, 0, 4); str.Nodes.Create(7, 3, 3, 4); str.Nodes.Create(8, 0, 3, 4); str.Bars.Create(1, 1, 5); str.Bars.Create(2, 2, 6); str.Bars.Create(3, 3, 7); str.Bars.Create(4, 4, 8); str.Bars.Create(5, 5, 6); str.Bars.Create(6, 7, 8); Console.WriteLine("Generating labels..."); RobotLabelServer labels = str.Labels; string columnSectionName = "Rect. Column 30*30"; IRobotLabel label = labels.Create(IRobotLabelType.I_LT_BAR_SECTION, columnSectionName); RobotBarSectionData section = (RobotBarSectionData)label.Data; section.ShapeType = IRobotBarSectionShapeType.I_BSST_CONCR_COL_R; RobotBarSectionConcreteData concrete = (RobotBarSectionConcreteData)section.Concrete; concrete.SetValue(IRobotBarSectionConcreteDataValue.I_BSCDV_COL_B, 0.3); concrete.SetValue(IRobotBarSectionConcreteDataValue.I_BSCDV_COL_H, 0.3); section.CalcNonstdGeometry(); labels.Store(label); Console.WriteLine("Defining sections..."); RobotSelection selectionBars = str.Selections.Get(IRobotObjectType.I_OT_BAR); selectionBars.FromText("1 2 3 4"); str.Bars.SetLabel(selectionBars, IRobotLabelType.I_LT_BAR_SECTION, columnSectionName); RobotSectionDatabaseList steelSections = projectPrefs.SectionsActive; if (steelSections.Add("RCAT") == 1) { Console.WriteLine("Warning! Steel section base RCAT not found..."); } selectionBars.FromText("5 6"); label = labels.Create(IRobotLabelType.I_LT_BAR_SECTION, "HEA 340"); str.Labels.Store(label); str.Bars.SetLabel(selectionBars, IRobotLabelType.I_LT_BAR_SECTION, "HEA 340"); Console.WriteLine("Defining materials..."); string materialName = "Concrete 30"; label = labels.Create(IRobotLabelType.I_LT_MATERIAL, materialName); RobotMaterialData material = (RobotMaterialData)label.Data; material.Type = IRobotMaterialType.I_MT_CONCRETE; material.E = 3E+09; material.NU = 1 / 6; material.RO = 25000; material.Kirchoff = material.E / (2 * (1 + material.NU)); Console.WriteLine("Generating slab..."); RobotPointsArray points = (RobotPointsArray)robApp.CmpntFactory.Create(IRobotComponentType.I_CT_POINTS_ARRAY); points.SetSize(5); points.Set(1, 0, 0, 4); points.Set(2, 3, 0, 4); points.Set(3, 3, 3, 4); points.Set(4, 0, 3, 4); points.Set(5, 0, 0, 4); string slabSectionName = "Slab 30"; label = labels.Create(IRobotLabelType.I_LT_PANEL_THICKNESS, slabSectionName); RobotThicknessData thickness = (RobotThicknessData)label.Data; thickness.MaterialName = materialName; thickness.ThicknessType = IRobotThicknessType.I_TT_HOMOGENEOUS; RobotThicknessHomoData thicknessData = (RobotThicknessHomoData)thickness.Data; thicknessData.ThickConst = 0.3; labels.Store(label); RobotObjObject slab; int objNumber = str.Objects.FreeNumber; str.Objects.CreateContour(objNumber, points); slab = (RobotObjObject)str.Objects.Get(objNumber); slab.Main.Attribs.Meshed = 1; slab.SetLabel(IRobotLabelType.I_LT_PANEL_THICKNESS, slabSectionName); slab.Initialize(); Console.WriteLine("Adding hole in the slab..."); points.Set(1, 1.1, 1.1, 4); points.Set(2, 2.5, 1.1, 4); RobotObjObject hole; Console.ReadLine(); }
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; }
public static void Design(Frame frame) { IRDimServer RDmServer; RDimStream RDmStream; IRDimGroups RDmGrps; RDimGroup RDmGrp1; RDimGrpProfs RDmGrpProfs; int BeamNo; int ColumnNo; RDmServer = robotApp.Project.DimServer; RDmServer.Mode = IRDimServerMode.I_DSM_STEEL; RDmGrps = RDmServer.GroupsService; BeamNo = 1; RDmGrp1 = RDmGrps.New(0, BeamNo); RDmGrp1.Name = "HNDZ-Beams"; RDmStream = RDmServer.Connection.GetStream(); RDmStream.Clear(); RDmStream.WriteText("3 4"); RDmGrp1.SetMembList(RDmStream); RDmGrpProfs = RDmServer.Connection.GetGrpProfs(); RDmGrpProfs.Clear(); RDmStream.Clear(); RDmGrp1.SetProfs(RDmGrpProfs); RDmGrps.Save(RDmGrp1); //Group 2 ColumnNo = 2; RDmGrp1 = RDmGrps.New(0, ColumnNo); RDmGrp1.Name = "HNDZ-Columns"; RDmStream = RDmServer.Connection.GetStream(); RDmStream.Clear(); RDmStream.WriteText("1 2"); RDmGrp1.SetMembList(RDmStream); RDmGrpProfs = RDmServer.Connection.GetGrpProfs(); RDmGrpProfs.Clear(); RDmStream.Clear(); RDmGrp1.SetProfs(RDmGrpProfs); RDmGrps.Save(RDmGrp1); // add Section Data to members IRobotLabel BeamTypeLabel; IRDimMembDefData BeamMembDefData; BeamTypeLabel = labelServer.Create(IRobotLabelType.I_LT_MEMBER_TYPE, "Hndz-Beam"); BeamMembDefData = BeamTypeLabel.Data; //============================================ // K factors needs to be reviewed BeamMembDefData.SetDeflectionYZ(IRDimMembDefDeflDataType.I_DMDDDT_DEFL_Y, 1); BeamMembDefData.SetDeflectionYZ(IRDimMembDefDeflDataType.I_DMDDDT_DEFL_Z, 1); BeamMembDefData.Type = IRDimMembDefType.I_DMDT_USER; labelServer.Store(BeamTypeLabel); RobotSelection Selection = robotApp.Project.Structure.Selections.Create(IRobotObjectType.I_OT_BAR); Selection.AddOne(frame.Beams[0].Id); Selection.AddOne(frame.Beams[1].Id); barServer.SetLabel(Selection, IRobotLabelType.I_LT_MEMBER_TYPE, BeamTypeLabel.Name); //========================= IRobotLabel ColumnTypeLabel; IRDimMembDefData ColumnMembDefData; ColumnTypeLabel = labelServer.Create(IRobotLabelType.I_LT_MEMBER_TYPE, "Hndz-Column"); ColumnMembDefData = ColumnTypeLabel.Data; ColumnMembDefData.Type = IRDimMembDefType.I_DMDT_USER; labelServer.Store(ColumnTypeLabel); //======================== RobotSelection Selection2 = robotApp.Project.Structure.Selections.Create(IRobotObjectType.I_OT_BAR); Selection.AddOne(frame.Columns[0].Id); Selection.AddOne(frame.Columns[1].Id); barServer.SetLabel(Selection, IRobotLabelType.I_LT_MEMBER_TYPE, ColumnTypeLabel.Name); //================= //Calutlation enginer IRDimCalcEngine RdmEngine = robotApp.Project.DimServer.CalculEngine; IRDimCalcParam RdmCalPar = RdmEngine.GetCalcParam(); IRDimCalcConf RdmCalCnf = RdmEngine.GetCalcConf(); RDimStream RdmStream = robotApp.Project.DimServer.Connection.GetStream(); RdmStream.Clear(); RdmStream.WriteText("all"); RdmCalPar.SetObjsList(IRDimCalcParamVerifType.I_DCPVT_GROUPS_DESIGN, RdmStream); RdmCalPar.SetLimitState(IRDimCalcParamLimitStateType.I_DCPLST_SERVICEABILITY, 1); RdmCalPar.SetLimitState(IRDimCalcParamLimitStateType.I_DCPLST_ULTIMATE, 1); RdmStream.Clear(); RdmStream.WriteText("1 2"); RdmCalPar.SetLoadsList(RdmStream); RdmEngine.SetCalcConf(RdmCalCnf); RdmEngine.SetCalcParam(RdmCalPar); }
/// <summary> /// Gets the FE meshes from a Robot model using the fast query method /// </summary> /// <param name="panel_ids"></param> /// <param name="coords"></param> /// <param name="vertex_indices"></param> /// <param name="str_nodes"></param> /// <param name="filePath"></param> /// <returns></returns> public static bool GetFEMeshQuery(out int[] panel_ids, out double[][] coords, out Dictionary <int, int[]> vertex_indices, string filePath = "LiveLink") { RobotApplication robot = null; if (filePath == "LiveLink") { robot = new RobotApplication(); } //First call getnodesquery to get node points double[][] nodeCoords = null; //Dictionary<int, BHoM.Structural.Node> _str_nodes = new Dictionary<int, BHoM.Structural.Node>(); //RobotToolkit.Node.GetNodesQuery(project, filePath); //Dictionary<int, int> _nodeIds = new Dictionary<int, int>(); //for (int i = 0; i < _str_nodes.Count; i++) //{ // _nodeIds.Add(_str_nodes.ElementAt(i).Value.Number, i); //} RobotResultQueryParams result_params = (RobotResultQueryParams)robot.Kernel.CmpntFactory.Create(IRobotComponentType.I_CT_RESULT_QUERY_PARAMS); RobotStructure rstructure = robot.Project.Structure; RobotSelection FE_sel = rstructure.Selections.CreateFull(IRobotObjectType.I_OT_FINITE_ELEMENT); IRobotResultQueryReturnType query_return = IRobotResultQueryReturnType.I_RQRT_MORE_AVAILABLE; RobotSelection cas_sel = rstructure.Selections.Create(IRobotObjectType.I_OT_CASE); try { cas_sel.FromText(robot.Project.Structure.Cases.Get(1).Number.ToString()); } catch { } if (cas_sel.Count > 0) { result_params.Selection.Set(IRobotObjectType.I_OT_CASE, cas_sel); } //result_params.Selection.Set(IRobotObjectType.I_OT_NODE, FE_sel); result_params.SetParam(IRobotResultParamType.I_RPT_MULTI_THREADS, true); result_params.SetParam(IRobotResultParamType.I_RPT_THREAD_COUNT, 4); result_params.SetParam(IRobotResultParamType.I_RPT_SMOOTHING, IRobotFeResultSmoothing.I_FRS_NO_SMOOTHING); result_params.SetParam(IRobotResultParamType.I_RPT_DIR_X_DEFTYPE, IRobotObjLocalXDirDefinitionType.I_OLXDDT_CARTESIAN); result_params.SetParam(IRobotResultParamType.I_RPT_DIR_X, new double[] { 1, 0, 0 }); result_params.SetParam(IRobotResultParamType.I_RPT_NODE, 1); result_params.SetParam(IRobotResultParamType.I_RPT_PANEL, 1); result_params.SetParam(IRobotResultParamType.I_RPT_ELEMENT, 1); result_params.SetParam(IRobotResultParamType.I_RPT_RESULT_POINT_COORDINATES, 1); result_params.ResultIds.SetSize(2); result_params.ResultIds.Set(1, (int)IRobotFeResultType.I_FRT_DETAILED_MXX); result_params.ResultIds.Set(2, (int)IRobotFeResultType.I_FRT_DETAILED_MYY); RobotResultRowSet row_set = new RobotResultRowSet(); bool ok = false; RobotResultRow result_row = default(RobotResultRow); List <int> _panel_ids = new List <int>(); Dictionary <int, int[]> _vertex_indices = new Dictionary <int, int[]>(); int kounta = 0; while (!(query_return == IRobotResultQueryReturnType.I_RQRT_DONE)) { query_return = rstructure.Results.Query(result_params, row_set); ok = row_set.MoveFirst(); while (ok) { //int panel_num = (int)row_set.CurrentRow.GetValue(1252); //_panel_ids.Add(panel_num); int nodeId = (int)row_set.CurrentRow.GetParam(IRobotResultParamType.I_RPT_NODE); //int panelId = (int)row_set.CurrentRow.GetParam(IRobotResultParamType.I_RPT_PANEL); int elementId = (int)row_set.CurrentRow.GetParam(IRobotResultParamType.I_RPT_ELEMENT); //int number_of_indices = (row_set.CurrentRow.IsAvailable(567)) ? 4 : 3; //int[] temp_indices = new int[number_of_indices]; //for (int i = 0; i < number_of_indices; i++) //{ // temp_indices[i] = (int)row_set.CurrentRow.GetValue(564 + i); //} var resultIds = row_set.ResultIds; var xxxx = row_set.CurrentRow.GetParam(IRobotResultParamType.I_RPT_RESULT_POINT_COORDINATES); //_vertex_indices.Add(kounta, temp_indices); //kounta++; ok = row_set.MoveNext(); } row_set.Clear(); } result_params.Reset(); panel_ids = _panel_ids.ToArray(); vertex_indices = _vertex_indices; coords = nodeCoords; //str_nodes = _str_nodes; return(true); }
public void createFrame(double g, double d, double b, double c, double e, string railBeam, string column, string wheelBeam) { //Disable Robot software iteraction with the user iRobotApp.Interactive = 0; //Create a new 3D Frame //iRobotApp.Project.New(IRobotProjectType.I_PT_FRAME_3D); //Creating nodes nodes = new List <Node>(); nodes.Add(new Node(1, 0, 0, 0)); nodes.Add(new Node(2, 0, g, 0)); nodes.Add(new Node(3, 0, g / 2, (d + b) / 2)); nodes.Add(new Node(4, (c - e) / 2, g / 2, (d + b) / 2)); nodes.Add(new Node(5, (c - e) / 2 + e, g / 2, (d + b) / 2)); nodes.Add(new Node(6, c, g / 2, (d + b) / 2)); nodes.Add(new Node(7, c, 0, 0)); nodes.Add(new Node(8, c, g, 0)); IRobotNodeServer iNodes = iRobotApp.Project.Structure.Nodes; RobotSelection supportSelection = iRobotApp.Project.Structure.Selections.Create(IRobotObjectType.I_OT_NODE); supportSelection.Clear(); string supportLabels = getConstraintLabel(); foreach (Node n in nodes) { iNodes.Create(n.id, n.xCoord, n.yCoord, n.zCoord); //Setting constraint labels switch (n.id) { case 1: case 2: case 7: case 8: supportSelection.AddOne(n.id); break; } iNodes.SetLabel(supportSelection, IRobotLabelType.I_LT_SUPPORT, supportLabels); } //Creating bars bars = new List <Bar>(); bars.Add(new Bar(1, nodes[0], nodes[1], MemberType.WheelBeam)); bars.Add(new Bar(2, nodes[0], nodes[2], MemberType.Column)); bars.Add(new Bar(3, nodes[1], nodes[2], MemberType.Column)); bars.Add(new Bar(4, nodes[0], nodes[3], MemberType.Column)); bars.Add(new Bar(5, nodes[1], nodes[3], MemberType.Column)); bars.Add(new Bar(6, nodes[2], nodes[5], MemberType.RailBeam)); bars.Add(new Bar(7, nodes[6], nodes[4], MemberType.Column)); bars.Add(new Bar(8, nodes[7], nodes[4], MemberType.Column)); bars.Add(new Bar(9, nodes[6], nodes[5], MemberType.Column)); bars.Add(new Bar(10, nodes[7], nodes[5], MemberType.Column)); bars.Add(new Bar(11, nodes[6], nodes[7], MemberType.WheelBeam)); addRobotBars(0, column, railBeam, wheelBeam, null); //Set the geometry created status to true geometryCreated = true; //Allow the user to work with Robot Sofware GUI iRobotApp.Interactive = 1; }//createFrame
private void ButtonExecute_Click(object sender, EventArgs e) { if (!IsRobotActive()) { return; } Vctr movementVector = new Vctr(); string str_coord; double[] validatedCoordsList = { 0, 0, 0 }; selection = structure.Selections.Get(IRobotObjectType.I_OT_NODE); if (selection.Count == 0) { ErrorDialog("No nodes have been selected", "ERROR: No selection"); return; } // If Relative to Node No. has been selected, fetch coordinates // of the node referred to in the input field if (radioRelativeNode.Checked) { try { str_coord = ReturnCoordString(helpers.ValidateNodeID(coordInput.Text), comboBoxCoords.Text); } catch (ArgumentOutOfRangeException) { ErrorDialog("Node does not exist", "ERROR: Node Not Found"); return; } catch (ArgumentException) { ErrorDialog("Invalid node number input", "ERROR: Invalid Node Input"); return; } } else { str_coord = coordInput.Text.Replace(" ", ""); // Validate coordinate inputs before any changes are made try { if (comboBoxCoords.SelectedItem.ToString() == "XYZ") { for (int i = 0; i < 3; i++) { validatedCoordsList[i] = helpers.ValidateSingleCoord(str_coord, i); } } else { if (str_coord.Contains(",")) { ErrorDialog("Please enter a single coordinate into the input field", "ERROR: Invalid Coordinates"); return; } else { validatedCoordsList[0] = helpers.ValidateSingleCoord(str_coord); } } } catch (ArgumentException) { ErrorDialog("Invalid coordinates input in text box. Please use a format of 'x,y,z'", "ERROR: Invalid Coordinates"); return; } } for (int i = 1; i <= selection.Count; i++) { var node = (IRobotNode)nodes.Get(selection.Get(i)); movementVector.X = node.X; movementVector.Y = node.Y; movementVector.Z = node.Z; if (comboBoxCoords.SelectedItem.ToString() == "XYZ") { for (int j = 0; j < 3; j++) { movementVector.Move(j, validatedCoordsList[j], radioRelative.Checked); } } else { movementVector.Move(comboBoxCoords.SelectedItem.ToString(), validatedCoordsList[0], radioRelative.Checked); } if (radioButtonMove.Checked) { node.X = movementVector.X; node.Y = movementVector.Y; node.Z = movementVector.Z; } else { nodes.Create(nodes.FreeNumber, movementVector.X, movementVector.Y, movementVector.Z); } } MessageBox.Show("Finished modifying " + selection.Count + " nodes.", "Action Completed"); }
/// <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(); }
// 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(); }