private static void CreateNewProjectWithSlab() { var robot = new RobotApplication(); robot.Project.New(IRobotProjectType.I_PT_SHELL); robot.Visible = 1; var preferences = robot.Project.Preferences; var meshParams = preferences.MeshParams; var strt = robot.Project.Structure; var labels = strt.Labels; robot.Project.Structure.Nodes.Create(1, 0, 0, 0); robot.Project.Structure.Nodes.Create(2, 3, 0, 0); robot.Project.Structure.Nodes.Create(3, 3, 3, 0); robot.Project.Structure.Nodes.Create(4, 0, 3, 0); var points = robot.Kernel.CmpntFactory.Create(IRobotComponentType.I_CT_POINTS_ARRAY) as RobotPointsArray; points.SetSize(4); points.Set(1, 0, 0, 0); points.Set(2, 3, 0, 0); points.Set(3, 3, 3, 0); points.Set(4, 0, 3, 0); var material = labels.Create(IRobotLabelType.I_LT_MATERIAL, "C30"); var materialData = material.Data as IRobotMaterialData; materialData.Type = IRobotMaterialType.I_MT_CONCRETE; materialData.E = 30000000000; materialData.NU = 0.2; materialData.RO = 25000; materialData.Kirchoff = materialData.E / (2 * (1 + materialData.NU)); labels.Store(material); var label = labels.Create(IRobotLabelType.I_LT_PANEL_THICKNESS, "Slab30"); if (label.Data is RobotThicknessData thickness) { thickness.MaterialName = "C30"; thickness.ThicknessType = IRobotThicknessType.I_TT_HOMOGENEOUS; ((IRobotThicknessHomoData)thickness.Data).ThickConst = 0.3; } labels.Store(label); var slabNumber = strt.Objects.FreeNumber; strt.Objects.CreateContour(slabNumber, points); RobotObjObject slab = null; if (strt.Objects.Get(slabNumber) is RobotObjObject) { slab = strt.Objects.Get(slabNumber) as RobotObjObject; slab.Main.Attribs.Meshed = 1; slab.SetLabel(IRobotLabelType.I_LT_PANEL_THICKNESS, "Slab30"); slab.Initialize(); } var supportLabel = labels.Create(IRobotLabelType.I_LT_SUPPORT, "Footer"); var footData = supportLabel.Data as RobotNodeSupportData; footData.UX = 1; footData.UY = 1; footData.UZ = 1; footData.RX = 1; footData.RY = 1; footData.RZ = 1; labels.Store(supportLabel); var selection = strt.Selections.Get(IRobotObjectType.I_OT_NODE); selection.FromText("1 2 3 4"); strt.Nodes.SetLabel(selection, IRobotLabelType.I_LT_SUPPORT, "Footer"); var selfWeight = strt.Cases.CreateSimple(1, "SW", IRobotCaseNature.I_CN_PERMANENT, IRobotCaseAnalizeType.I_CAT_STATIC_LINEAR); selfWeight.Records.New(IRobotLoadRecordType.I_LRT_DEAD); var rec = selfWeight.Records.Get(1) as RobotLoadRecord; rec.SetValue((short)IRobotBarDeadRecordValues.I_BDRV_ENTIRE_STRUCTURE, 1); rec.SetValue((short)IRobotBarDeadRecordValues.I_BDRV_Z, -1); var liveLoad = strt.Cases.CreateSimple(2, "Live", IRobotCaseNature.I_CN_EXPLOATATION, IRobotCaseAnalizeType.I_CAT_STATIC_LINEAR); var uniform = liveLoad.Records.New(IRobotLoadRecordType.I_LRT_UNIFORM); var liveRec = liveLoad.Records.Get(uniform) as RobotLoadRecord; liveRec.SetValue((short)IRobotUniformRecordValues.I_URV_PX, 0); liveRec.SetValue((short)IRobotUniformRecordValues.I_URV_PY, 0); liveRec.SetValue((short)IRobotUniformRecordValues.I_URV_PZ, -1000); liveRec.Objects.FromText(slabNumber.ToString()); preferences.SetActiveCode(IRobotCodeType.I_CT_CODE_COMBINATIONS, "BAEL 93"); robot.Project.CalcEngine.Calculate(); var nodeResults = robot.Project.Structure.Results.Nodes; Console.WriteLine(nodeResults.Reactions.Value(2, 1).FZ); Console.WriteLine(nodeResults.Reactions.Value(2, 2).FZ); Console.WriteLine(nodeResults.Reactions.Value(2, 3).FZ); Console.WriteLine(nodeResults.Reactions.Value(2, 4).FZ); var feSelection = strt.Selections.Get(IRobotObjectType.I_OT_FINITE_ELEMENT); feSelection.FromText(slab.FiniteElems); var feLabels = strt.FiniteElems.GetMany(feSelection); }
private static void CalcReinforcement(RobotApplication robApp, int objNumber, RobotLabelServer labels, RobotObjObject slab, IRobotStructure str) { IRobotLabel label; var concrCalcEngine = robApp.Project.ConcrReinfEngine; var concrSlabRequiredReinfEngine = concrCalcEngine.SlabRequiredReinf; var slabRnfParams = concrSlabRequiredReinfEngine.Params; slabRnfParams.Method = IRobotReinforceCalcMethods.I_RCM_WOOD_ARMER; slabRnfParams.GloballyAvgDesginForces = false; slabRnfParams.ForcesReduction = false; slabRnfParams.DisplayErrors = false; slabRnfParams.CasesULS.FromText("1 2 3 4 5 6 7 8"); var slabs = slabRnfParams.Panels; slabs.FromText(System.Convert.ToString(objNumber)); var slabReinforcementName = "Slab X"; label = labels.Create(IRobotLabelType.I_LT_PANEL_REINFORCEMENT, slabReinforcementName); labels.Store(label); slab.SetLabel(IRobotLabelType.I_LT_PANEL_REINFORCEMENT, slabReinforcementName); slab.Update(); Console.WriteLine(!concrSlabRequiredReinfEngine.Calculate() ? "Calculation Failed!" : "Done!"); //getting results My and Yz for beam (bar 5) with live load (case 2) var txt = "Bar 5, Live at 0.5 length:" + "\n\r" + " My = " + str.Results.Bars.Forces.Value(5, 2, 0.5).MY / 1000 + " [kN*m]" + "\n\r" + " Qz = " + -str.Results.Bars.Deflections.Value(5, 2, 0.5).UZ * 1000 + " [mm]" + "\n\r" + " Fz1 = " + str.Results.Bars.Forces.Value(5, 2, 0).FZ / 1000 + " [kN]" + "\n\r" + " Fz2 = " + str.Results.Bars.Forces.Value(5, 2, 1).FZ / 1000 + " [kN]" + "\n\r"; //getting results Fx and Fy for column (bar 4) with wind load (case 3) txt += "Bar 4, Wind:" + "\n\r" + " Fx = " + str.Results.Bars.Forces.Value(4, 3, 1).FX / 1000 + " [kN]" + "\n\r" + " Fy = " + str.Results.Bars.Forces.Value(4, 3, 1).FY / 1000 + " [kN]" + "\n\r"; //getting results Fx, Fy, Fz, Mx, My, Mz for foot (node 1) with self-weight (case 1) txt += "Node 1, Self-Weight:" + "\n\r" + " Fx = " + str.Results.Nodes.Reactions.Value(1, 1).FX / 1000 + " [kN]" + "\n\r" + " Fy = " + str.Results.Nodes.Reactions.Value(1, 1).FY / 1000 + " [kN]" + "\n\r" + " Fz = " + str.Results.Nodes.Reactions.Value(1, 1).FZ / 1000 + " [kN]" + "\n\r" + " Mx = " + str.Results.Nodes.Reactions.Value(1, 1).MX / 1000 + " [kN]" + "\n\r" + " My = " + str.Results.Nodes.Reactions.Value(1, 1).MY / 1000 + " [kN]" + "\n\r" + " Mz = " + str.Results.Nodes.Reactions.Value(1, 1).MZ / 1000 + " [kN]" + "\n\r"; //getting results Ax+, Ax-, Ay+, Ay- for slab var selectionFe = str.Selections.Get(IRobotObjectType.I_OT_FINITE_ELEMENT); selectionFe.FromText(slab.FiniteElems); var objFEs = (RobotLabelCollection)str.FiniteElems.GetMany(selectionFe); double a; a = 0; double axP = 0; double axM = 0; double ayP = 0; double ayM = 0; var finiteElementNodes = new List <RobotFiniteElement>(); for (var n = 1; n <= objFEs.Count; n++) { var fe = (RobotFiniteElement)objFEs.Get(n); finiteElementNodes.Add(fe); a = str.Results.FiniteElems.Reinforcement(slab.Number, fe.Number).AX_BOTTOM; if (a > axM) { axM = a; } a = str.Results.FiniteElems.Reinforcement(slab.Number, fe.Number).AX_TOP; if (a > axP) { axP = a; } a = str.Results.FiniteElems.Reinforcement(slab.Number, fe.Number).AY_BOTTOM; if (a > ayM) { ayM = a; } a = str.Results.FiniteElems.Reinforcement(slab.Number, fe.Number).AY_TOP; if (a > ayP) { ayP = a; } } //getting results Fx, Fy, Fz, Mx, My, Mz for foot (node 1) with self-weight (case 1) txt += "Slab 1, Reinforcemet extreme values:" + "\n\r" + " Ax+ = " + axP * 10000 + " [cm2]" + "\n\r" + " Ax- = " + axM * 10000 + " [cm2]" + "\n\r" + " Ay+ = " + ayP * 10000 + " [cm2]" + "\n\r" + " Ay- = " + ayM * 10000 + " [cm2]" + "\n\r"; foreach (var fe in finiteElementNodes) { var nodes = fe.Nodes; Console.WriteLine( $"{fe.Number} - {Enumerable.Range(0, nodes.Count).Aggregate("", (x, y) => $"{x} {nodes.Get(y)}")}"); } Console.WriteLine(txt); }