Exemplo n.º 1
0
 public static void InitRobot()
 {
     robotApp         = new RobotApplication();
     nodeServer       = robotApp.Project.Structure.Nodes;
     barServer        = robotApp.Project.Structure.Bars;
     caseServer       = robotApp.Project.Structure.Cases;
     labelServer      = robotApp.Project.Structure.Labels;
     PrefrencesServer = robotApp.Project.Preferences;
     barForceServer   = robotApp.Project.Structure.Results.Bars.Forces;
 }
Exemplo n.º 2
0
        private double _windz = 0.0;    //the wind vector

        /// <summary>
        /// Create the Robot model from scratch.
        /// </summary>
        /// <param name="_nodeInfo">A List of node objects.</param>
        /// <param name="_barInfo">A List of bar objects.</param>
        public RobotModel(IRobotApplication robot, IEnumerable <AnalyticalNode> nodeInfo, IEnumerable <AnalyticalBar> barInfo, IEnumerable <AnalyticalPlate> plateInfo)
        {
            robot.Project.New(RobotOM.IRobotProjectType.I_PT_SHELL);
            _project = robot.Project;

            if (_project == null)
            {
                throw new Exception("The robot project could not be initialized.");
            }

            //create the structure and the node and bar servers
            _structure = _project.Structure;
            _nodes     = _structure.Nodes;
            _bars      = _structure.Bars;
            _objects   = _structure.Objects;

            List <int> forWindLoads      = new List <int>();
            List <int> forLiveLoads      = new List <int>();
            List <int> forBuildingLoads  = new List <int>();
            List <int> forDeadLoadsBars  = new List <int>();
            List <int> forDeadLoadsSlabs = new List <int>();

            double windLoad     = 0.0;
            double liveLoad     = 0.0;
            double buildingLoad = 0.0;
            double fatManLoad   = 300 * 4.45;           //300lbs. -> Newton

            IRobotSimpleCase ll;
            IRobotSimpleCase dl;
            IRobotSimpleCase bl;
            IRobotSimpleCase wl;

            CreateLoadCases(out ll, out dl, out wl, out bl);

            CreateLoads(ll, dl, wl, bl);

            CreateBarEndRelease(_barInfo);

            CreateNodes();

            CreateBars(forDeadLoadsBars);

            #region plates

            CreatePlates(liveLoad, forLiveLoads, windLoad, forWindLoads, buildingLoad, forBuildingLoads, forDeadLoadsSlabs, ll, wl, bl, fatManLoad, dl, forDeadLoadsBars);

            #endregion
        }
Exemplo n.º 3
0
        }//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
Exemplo n.º 4
0
        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;
        }
Exemplo n.º 5
0
        private double _windz = 0.0; //the wind vector

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Create the Robot model from scratch.
        /// </summary>
        /// <param name="_nodeInfo">A List of node objects.</param>
        /// <param name="_barInfo">A List of bar objects.</param>
        public RobotModel(IRobotApplication robot, IEnumerable<AnalyticalNode> nodeInfo, IEnumerable<AnalyticalBar> barInfo, IEnumerable<AnalyticalPlate> plateInfo)
        {
            robot.Project.New(RobotOM.IRobotProjectType.I_PT_SHELL);
            _project = robot.Project;

            if (_project == null)
                throw new Exception("The robot project could not be initialized.");

            //create the structure and the node and bar servers
            _structure = _project.Structure;
            _nodes = _structure.Nodes;
            _bars = _structure.Bars;
            _objects = _structure.Objects;

            List<int> forWindLoads = new List<int>();
            List<int> forLiveLoads = new List<int>();
            List<int> forBuildingLoads = new List<int>();
            List<int> forDeadLoadsBars = new List<int>();
            List<int> forDeadLoadsSlabs = new List<int>();

            double windLoad	= 0.0;
            double liveLoad = 0.0;
            double buildingLoad = 0.0;
            double fatManLoad = 300 * 4.45;	//300lbs. -> Newton

            IRobotSimpleCase ll;
            IRobotSimpleCase dl;
            IRobotSimpleCase bl;
            IRobotSimpleCase wl;
            CreateLoadCases(out ll, out dl, out wl, out bl);

            CreateLoads(ll,dl, wl, bl);

            CreateBarEndRelease(_barInfo);

            CreateNodes();

            CreateBars(forDeadLoadsBars);

            #region plates

            CreatePlates(liveLoad, forLiveLoads, windLoad, forWindLoads, buildingLoad, forBuildingLoads, forDeadLoadsSlabs, ll, wl, bl, fatManLoad, dl, forDeadLoadsBars);

            #endregion
        }
Exemplo n.º 6
0
        /// <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();
        }
Exemplo n.º 7
0
        // 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();
        }