예제 #1
0
        /// <summary>
        /// 点击生成干涉区LB
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button2_Click(object sender, EventArgs e)
        {
            TxApplication.ActiveUndoManager.StartTransaction();
            TxPlcProgram pr = TxApplication.ActiveDocument.PlcProgramRoot.CurrentPlcProgram;

            RobDictionary = new Dictionary <string, TxRobot>();
            ModDictionary = new Dictionary <string, ITxPlcModule>();
            LBDictionary  = new Dictionary <string, TxPlcLogicBehavior>();

            foreach (TxRobot r in Robots)
            {
                RobDictionary.Add(r.Name, r);
                //ModDictionary.Add(r.Name, pr.CreateModule(new TxPlcModuleCreationData(r.Name)));
                LBDictionary.Add(r.Name, CreatNewLB(r.Name));
            }


            for (int i = 0; i < dgv_Robotlist.Rows.Count; i++)
            {
                if (dgv_Robotlist.Rows[i].Cells[0].Style.BackColor == System.Drawing.SystemColors.Highlight)
                {
                    string rob1name = dgv_Robotlist.Rows[i].Cells[0].Value.ToString();

                    for (int j = 0; j < dgv_robotzone.Columns.Count; j++)
                    {
                        string rob2name = dgv_robotzone.Columns[j].HeaderText;
                        object zone     = dgv_robotzone.Rows[i].Cells[j].Value;
                        if (zone != null)
                        {
                            if (zone != "")
                            {
                                if (rb_minokuka.Checked == true || rb_minofanuc.Checked == true)
                                {
                                    //ZoneModlueM(rob1name, RobDictionary[rob1name].Signals, rob2name, RobDictionary[rob2name].Signals, zone.ToString().Split('.'), ModDictionary["Zone"]);

                                    ZoneLBM(rob1name, RobDictionary[rob1name].Signals, rob2name, RobDictionary[rob2name].Signals, zone.ToString().Split('.'), LBDictionary[rob1name]);
                                }
                                else
                                {
                                    //ZoneModlueS(rob1name, RobDictionary[rob1name].Signals, rob2name, RobDictionary[rob2name].Signals, zone.ToString().Split('.'), ModDictionary["Zone"]);

                                    ZoneLBS(rob1name, RobDictionary[rob1name].Signals, rob2name, RobDictionary[rob2name].Signals, zone.ToString().Split('.'), LBDictionary[rob1name]);
                                }
                            }
                        }
                    }
                }
            }

            if (rb_minokuka.Checked == true || rb_minofanuc.Checked == true)
            {
            }
            else
            {
            }
            TxApplication.ActiveUndoManager.EndTransaction();
        }
예제 #2
0
        private void button2_Click(object sender, EventArgs e)
        {
            TxApplication.ActiveUndoManager.StartTransaction();
            TxPlcProgram pr = TxApplication.ActiveDocument.PlcProgramRoot.CurrentPlcProgram;

            RobDictionary = new Dictionary <string, TxRobot>();
            ModDictionary = new Dictionary <string, ITxPlcModule>();
            LBDictionary  = new Dictionary <string, TxPlcLogicBehavior>();

            foreach (TxRobot r in Robots)
            {
                RobDictionary.Add(r.Name, r);
                //ModDictionary.Add(r.Name, pr.CreateModule(new TxPlcModuleCreationData(r.Name)));
                LBDictionary.Add(r.Name, CreatNewLB(r.Name));
            }

            //foreach (ITxPlcModule mod in pr.PlcModules)
            //{
            //    if (mod.Name=="Zone")
            //    {
            //        mod.Delete();
            //    }
            //}
            //ModDictionary.Add("Zone", pr.CreateModule(new TxPlcModuleCreationData("Zone")));

            for (int i = 0; i < dataGridView3.Rows.Count; i++)
            {
                if (dataGridView3.Rows[i].Cells[0].Style.BackColor == System.Drawing.SystemColors.Highlight)
                {
                    string rob1name = dataGridView3.Rows[i].Cells[0].Value.ToString();

                    for (int j = 0; j < dataGridView1.Columns.Count; j++)
                    {
                        string rob2name = dataGridView1.Columns[j].HeaderText;
                        object zone     = dataGridView1.Rows[i].Cells[j].Value;
                        if (zone != null)
                        {
                            if (zone != "")
                            {
                                if (radioButton1.Checked == true || radioButton3.Checked == true)
                                {
                                    //ZoneModlueM(rob1name, RobDictionary[rob1name].Signals, rob2name, RobDictionary[rob2name].Signals, zone.ToString().Split('.'), ModDictionary["Zone"]);

                                    ZoneLBM(rob1name, RobDictionary[rob1name].Signals, rob2name, RobDictionary[rob2name].Signals, zone.ToString().Split('.'), LBDictionary[rob1name]);
                                }
                                else
                                {
                                    //ZoneModlueS(rob1name, RobDictionary[rob1name].Signals, rob2name, RobDictionary[rob2name].Signals, zone.ToString().Split('.'), ModDictionary["Zone"]);

                                    ZoneLBS(rob1name, RobDictionary[rob1name].Signals, rob2name, RobDictionary[rob2name].Signals, zone.ToString().Split('.'), LBDictionary[rob1name]);
                                }
                            }
                        }
                    }
                }
            }

            if (radioButton1.Checked == true || radioButton3.Checked == true)
            {
                SegLBM();
            }
            else
            {
                //SegModlueS();
                //SegModlueli();
                SegLBS();
            }
            TxApplication.ActiveUndoManager.EndTransaction();
        }