示例#1
0
        public void InitDataStream()
        {
            Task tRob1 = controller.Rapid.GetTask("T_ROB1");

            if (tRob1 != null)
            {
                rd_repeat = tRob1.GetRapidData("Module1", "repeat");
                if (rd_repeat.Value is Bool)
                {
                    repeatBool = (Bool)rd_repeat.Value;
                }

                rd_start = tRob1.GetRapidData("Module1", "flag");
                if (rd_start.Value is Num)
                {
                    processFlag = (Num)rd_start.Value;
                }

                rd_targetsNum = tRob1.GetRapidData("Module1", "targetsNum");
                if (rd_targetsNum.Value is Num)
                {
                    processFlag = (Num)rd_start.Value;
                }

                rd_speedLevel = tRob1.GetRapidData("Module1", "speedLevel");
                if (rd_speedLevel.Value is Num)
                {
                    speedLevel = (Num)rd_speedLevel.Value;
                }

                rd_targets = tRob1.GetRapidData("Module1", "tgPos");
                if (rd_targets.IsArray)
                {
                    targets = (ArrayData)rd_targets.Value;
                    int aRank = targets.Rank;
                    maxLength = targets.GetLength(aRank - 1);
                    ArrayModes am = targets.Mode;
                    Debug.WriteLine("ARRAY MODE! ::: " + am.ToString());
                    targets.Mode = ArrayModes.Dynamic;
                }
                else
                {
                    MessageBox.Show("'targets' data is not array!");
                }
                if (rd_targets == null)
                {
                    MessageBox.Show("'targets' data does not exist!");
                }
            }
        }