Exemple #1
0
        public void GetCases()
        {
            RobotApplication robapp = new RobotApplication();

            if (robapp == null)
            {
                return;
            }


            IRobotCaseCollection robotCaseCollection = robapp.Project.Structure.Cases.GetAll();

            for (int i = 0; i < robotCaseCollection.Count; i++)
            {
                try
                {
                    IRobotCase robotCase = robapp.Project.Structure.Cases.Get(i);
                    if (robotCase != null)
                    {
                        listBox1.Items.Add(robotCase.Name);
                    }
                }
                catch (Exception e)
                {
                }
            }

            if (listBox1.SelectedIndex == -1)
            {
                listBox1.SelectedIndex = 0;
            }


            robapp = null;
        }
        public static void Load(this RobotCaseDispatcherComponent self)
        {
            self.Dictionary.Clear();

            HashSet <Type> types = Game.EventSystem.GetTypes(typeof(RobotCaseAttribute));

            foreach (Type type in types)
            {
                object[] attrs = type.GetCustomAttributes(typeof(RobotCaseAttribute), false);
                if (attrs.Length == 0)
                {
                    continue;
                }

                RobotCaseAttribute attr = attrs[0] as RobotCaseAttribute;
                if (attr == null)
                {
                    continue;
                }

                IRobotCase robotCase = Activator.CreateInstance(type) as IRobotCase;
                if (robotCase == null)
                {
                    Log.Error($"RobotCase handle {type.Name} 需要继承 IRobotCase");
                    continue;
                }

                self.Dictionary.Add(attr.CaseType, robotCase);
            }
        }
Exemple #3
0
        public static List <ResultsR> GetResults()
        {
            List <ResultsR>      Results      = new List <ResultsR>();
            IRobotCollection     Bars         = robotApp.Project.Structure.Bars.GetAll();
            IRobotCaseCollection LoadingCases = robotApp.Project.Structure.Cases.GetAll();

            for (int i = 1; i <= Bars.Count; i++)
            {
                IRobotBar Element = Bars.Get(i);
                for (int j = 1; j <= LoadingCases.Count; j++)
                {
                    IRobotCase         Case      = LoadingCases.Get(j);
                    int                caseNum   = Case.Number;
                    IRobotBarForceData Force     = barForceServer.Value(i, caseNum, 0.5);
                    double             FX        = Force.FX;
                    double             FY        = Force.FY;
                    double             FZ        = Force.FZ;
                    double             MX        = Force.MX;
                    double             MY        = Force.MY;
                    double             MZ        = Force.MZ;
                    double             KY        = Force.KY;
                    double             KZ        = Force.KZ;
                    ResultsR           barResult = new ResultsR(FX, FY, FZ, MX, MY, MZ, KY, KZ);
                    Results.Add(barResult);
                }
            }
            return(Results);
        }
        public void GetCases()
        {
            RobotApplication robapp = new RobotApplication();

            if (robapp == null)
            {
                return;
            }


            IRobotCaseCollection robotCaseCollection = robapp.Project.Structure.Cases.GetAll();
            List <string>        cases = new List <string>();
            int        ULSCase         = -1;
            IRobotCase robotCase       = robapp.Project.Structure.Cases.Get(1);

            for (int i = 0; i < robotCaseCollection.Count; i++)
            {
                try
                {
                    robapp.Project.Structure.Cases.Get(i);
                    robotCase = robapp.Project.Structure.Cases.Get(i);
                }
                catch (Exception)
                {
                    continue;
                    throw new Exception("Case Collection error");
                }
                finally
                {
                    robapp = null;
                }



                if (robotCase != null)
                {
                    cases.Add(robotCase.Name);
                    TextBlock.Text += robotCase.Name;
                    if (robotCase.Name == "ULS")
                    {
                        ULSCase = i - 1;
                    }
                }
            }

            listBox1.ItemsSource   = cases;
            listBox1.SelectedIndex = ULSCase;

            if (listBox1.SelectedIndex == -1)
            {
                listBox1.SelectedIndex = 0;
            }


            robapp = null;
        }
Exemple #5
0
        //获取计算结果,当选择工况下拉框的值变化时触发
        private void getResults(object sender, EventArgs e)
        {
            if (iapp.Project.Structure.Results.Available == 0) //计算结果不可用
            {
                iapp.Project.CalcEngine.Calculate();           //进行结构计算
            }
            //清除表格
            dataGridView1.Rows.Clear();
            //增加12行
            dataGridView1.Rows.Add(12);
            //给表头赋值
            dataGridView1.Rows[0].Cells[0].Value  = "FX (N)";
            dataGridView1.Rows[1].Cells[0].Value  = "FY (N)";
            dataGridView1.Rows[2].Cells[0].Value  = "FZ (N)";
            dataGridView1.Rows[3].Cells[0].Value  = "MX (Nm)";
            dataGridView1.Rows[4].Cells[0].Value  = "MY (Nm)";
            dataGridView1.Rows[5].Cells[0].Value  = "MZ (Nm)";
            dataGridView1.Rows[6].Cells[0].Value  = "UX (m)";
            dataGridView1.Rows[7].Cells[0].Value  = "UY (m)";
            dataGridView1.Rows[8].Cells[0].Value  = "UZ (m)";
            dataGridView1.Rows[9].Cells[0].Value  = "RX (Rad)";
            dataGridView1.Rows[10].Cells[0].Value = "RY (Rad)";
            dataGridView1.Rows[11].Cells[0].Value = "RZ (Rad)";

            int        idx      = comboLoadCase.SelectedIndex + 1;                            //当前选择的工况索引
            IRobotCase ic       = (IRobotCase)iapp.Project.Structure.Cases.GetAll().Get(idx); //根据下拉框选择当前工况
            int        case_num = ic.Number;

            for (int n = startNode; n < startNode + 5; ++n)
            {
                IRobotReactionData     ireact = iapp.Project.Structure.Results.Nodes.Reactions.Value(n, case_num);     //获取工况编号为case_num的反力
                IRobotDisplacementData idisp  = iapp.Project.Structure.Results.Nodes.Displacements.Value(n, case_num); //获取工况编号为case_num的位移
                //将反力写入到表格中
                dataGridView1.Rows[0].Cells[n].Value = ireact.FX.ToString("####0.00");
                dataGridView1.Rows[1].Cells[n].Value = ireact.FY.ToString("####0.00");
                dataGridView1.Rows[2].Cells[n].Value = ireact.FZ.ToString("####0.00");
                dataGridView1.Rows[3].Cells[n].Value = ireact.MX.ToString("####0.00");
                dataGridView1.Rows[4].Cells[n].Value = ireact.MY.ToString("####0.00");
                dataGridView1.Rows[5].Cells[n].Value = ireact.MZ.ToString("####0.00");
                //将位移写入到表格中
                dataGridView1.Rows[6].Cells[n].Value  = idisp.UX.ToString("####0.00");
                dataGridView1.Rows[7].Cells[n].Value  = idisp.UY.ToString("####0.00");
                dataGridView1.Rows[8].Cells[n].Value  = idisp.UZ.ToString("####0.00");
                dataGridView1.Rows[9].Cells[n].Value  = idisp.RX.ToString("####0.00");
                dataGridView1.Rows[10].Cells[n].Value = idisp.RY.ToString("####0.00");
                dataGridView1.Rows[11].Cells[n].Value = idisp.RZ.ToString("####0.00");
            }
        }
Exemple #6
0
        //查看结果Tab页面的初始化
        private void tabControl2_Selected(object sender, TabControlEventArgs e)
        {
            // fill combo-box with names of all load cases defined in the structure
            comboLoadCase.Items.Clear();
            IRobotCollection icases = iapp.Project.Structure.Cases.GetAll();

            for (int i = 1; i <= icases.Count; ++i)
            {
                IRobotCase ic  = (IRobotCase)icases.Get(i);
                int        idx = comboLoadCase.Items.Add(ic.Name);
            }
            // select the first item
            if (comboLoadCase.Items.Count > 0)
            {
                comboLoadCase.SelectedIndex = 0;
            }
        }
Exemple #7
0
        //查看计算结果
        private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (tabControl1.SelectedTab == tabPage5)//进行tabpage位置判断
            {
                // fill combo-box with names of all load cases defined in the structure
                comboBoxLoadCombine.Items.Clear();
                IRobotCollection icases = iapp.Project.Structure.Cases.GetAll();
                for (int i = 1; i <= icases.Count; ++i)
                {
                    IRobotCase ic  = (IRobotCase)icases.Get(i);
                    int        idx = comboBoxLoadCombine.Items.Add(ic.Name);
                }
                // select the first item
                if (comboBoxLoadCombine.Items.Count > 0)
                {
                    comboBoxLoadCombine.SelectedIndex = 0;
                }


                if (iapp.Project.Structure.Results.Available == 0) //计算结果不可用
                {
                    iapp.Project.CalcEngine.Calculate();           //进行结构计算
                }
                //清除表格
                dataGridView1.Rows.Clear();
                int        index    = comboBoxLoadCombine.SelectedIndex + 1;                        //当前选择的工况索引
                IRobotCase icc      = (IRobotCase)iapp.Project.Structure.Cases.GetAll().Get(index); //根据下拉框选择当前工况
                int        case_num = icc.Number;

                for (int n = 0; n < 5; ++n)
                {
                    int indexData = dataGridView1.Rows.Add();
                    dataGridView1.Rows[indexData].Cells[0].Value = n + 1;
                    dataGridView1.Rows[indexData].Cells[1].Value = (iapp.Project.Structure.Results.Bars.Forces.Value(n + 1, case_num, 0).MY / 1000).ToString("####0.00");
                    dataGridView1.Rows[indexData].Cells[2].Value = (iapp.Project.Structure.Results.Bars.Forces.Value(n + 1, case_num, 0.5).MY / 1000).ToString("####0.00");
                    dataGridView1.Rows[indexData].Cells[3].Value = (iapp.Project.Structure.Results.Bars.Forces.Value(n + 1, case_num, 1).MY / 1000).ToString("####0.00");
                    dataGridView1.Rows[indexData].Cells[4].Value = (iapp.Project.Structure.Results.Bars.Forces.Value(n + 1, case_num, 0).FZ / 1000).ToString("####0.00");
                    dataGridView1.Rows[indexData].Cells[5].Value = (iapp.Project.Structure.Results.Bars.Forces.Value(n + 1, case_num, 0.5).FZ / 1000).ToString("####0.00");
                    dataGridView1.Rows[indexData].Cells[6].Value = (iapp.Project.Structure.Results.Bars.Forces.Value(n + 1, case_num, 1).FZ / 1000).ToString("####0.00");
                }
            }
        }
Exemple #8
0
        public static void GetResults()
        {
            IRobotCollection     Bars         = robotApp.Project.Structure.Bars.GetAll();
            IRobotCaseCollection LoadingCases = robotApp.Project.Structure.Cases.GetAll();

            for (int i = 1; i <= Bars.Count; i++)
            {
                IRobotBar Element = Bars.Get(i);
                for (int j = 1; j <= LoadingCases.Count; j++)
                {
                    IRobotCase         Case    = LoadingCases.Get(j);
                    int                caseNum = Case.Number;
                    IRobotBarForceData Force   = barForceServer.Value(i, caseNum, 0.5);
                    double             FX      = Force.FX;
                    double             FY      = Force.FY;
                    double             FZ      = Force.FZ;
                    double             MX      = Force.MX;
                    double             MY      = Force.MY;
                    double             MZ      = Force.MZ;
                }
            }
        }
Exemple #9
0
        private void GetResult()
        {
            if (iapp.Project.Structure.Results.Available == 0) //计算结果不可用
            {
                iapp.Project.CalcEngine.Calculate();           //进行结构计算
            }
            //清除表格
            dataGridView1.Rows.Clear();
            int        index    = comboBoxLoadCombine.SelectedIndex + 1;                        //当前选择的工况索引
            IRobotCase icc      = (IRobotCase)iapp.Project.Structure.Cases.GetAll().Get(index); //根据下拉框选择当前工况
            int        case_num = icc.Number;

            for (int n = 0; n < 5; ++n)
            {
                int indexData = dataGridView1.Rows.Add();
                dataGridView1.Rows[indexData].Cells[0].Value = n + 1;
                dataGridView1.Rows[indexData].Cells[1].Value = (iapp.Project.Structure.Results.Bars.Forces.Value(n + 1, case_num, 0).MY / 1000).ToString("####0.00");
                dataGridView1.Rows[indexData].Cells[2].Value = (iapp.Project.Structure.Results.Bars.Forces.Value(n + 1, case_num, 0.5).MY / 1000).ToString("####0.00");
                dataGridView1.Rows[indexData].Cells[3].Value = (iapp.Project.Structure.Results.Bars.Forces.Value(n + 1, case_num, 1).MY / 1000).ToString("####0.00");
                dataGridView1.Rows[indexData].Cells[4].Value = (iapp.Project.Structure.Results.Bars.Forces.Value(n + 1, case_num, 0).FZ / 1000).ToString("####0.00");
                dataGridView1.Rows[indexData].Cells[5].Value = (iapp.Project.Structure.Results.Bars.Forces.Value(n + 1, case_num, 0.5).FZ / 1000).ToString("####0.00");
                dataGridView1.Rows[indexData].Cells[6].Value = (iapp.Project.Structure.Results.Bars.Forces.Value(n + 1, case_num, 1).FZ / 1000).ToString("####0.00");
            }
        }
Exemple #10
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;
        }
Exemple #11
0
 /// <summary>
 /// Add a new Load Case entry to this mapping table
 /// </summary>
 /// <param name="loadCase"></param>
 /// <param name="rCase"></param>
 public void Add(LoadCase loadCase, IRobotCase rCase)
 {
     Add(CaseCategory, loadCase.GUID, rCase.Number.ToString());
 }