Example #1
0
        public void SetPath(List <BrushStatus> nativTargets, ProgressBar pb)
        {
            if (nativTargets.Count > maxLength)
            {
                targetsNum = maxLength;
            }
            else
            {
                targetsNum = nativTargets.Count;
            }

            rd_tgNumValue.FillFromString2(targetsNum.ToString());
            using (Mastership m = Mastership.Request(controller.Rapid))
            {
                rd_targetsNum.Value = rd_tgNumValue;
            }

            Pos rt;

            for (int i = 0; i < targetsNum; i++)
            {
                rt = new Pos();
                rt.FillFromString2("[" + nativTargets[i].X + "," + nativTargets[i].Y + "," + nativTargets[i].Z + "]");
                Debug.WriteLine(rt.ToString());
                using (Mastership m = Mastership.Request(controller.Rapid))
                {
                    rd_targets.WriteItem(rt, i);
                }
                pb.Increment(1);
            }
            pb.Value = 0;
        }
Example #2
0
 private void btn_cy1_Click(object sender, EventArgs e)
 {
     try
     {
         // MyRobot. MasterConytol();
         if (crd_SelectAction.IsArray)
         {
             ArrayData pp = (ArrayData)crd_SelectAction.Value;
             if (((Bool)pp[cPint - 1, 0]).ToString() == "True")
             {
                 btn_cy1.BackColor = Color.Gainsboro;;
                 Bool r_pp = new Bool();
                 r_pp.FillFromString2("False");
                 crd_SelectAction.WriteItem(r_pp, cPint - 1, 0);
             }
             if (((Bool)pp[cPint - 1, 0]).ToString() == "False")
             {
                 btn_cy1.BackColor = Color.Red;
                 Bool r_pp = new Bool();
                 r_pp.FillFromString2("True");
                 crd_SelectAction.WriteItem(r_pp, cPint - 1, 0);
             }
         }
     }
     catch (Exception re)
     {
         MyRobot.JudgeMaster();
         MessageBox.Show("没有获得相应权限" + re.Message);
     }
 }
Example #3
0
        public void ApplyData(RWSystem rwSystem)
        {
            RapidData rWeldProcedureArray = rwSystem.Controller.Rapid.GetRapidData(strTaskName, strDataModuleName, strDataName + this.intGroupIndex);
            //RapidDataType rWeldProcedureType = rwSystem.Controller.Rapid.GetRapidDataType(strTaskName, strDataTypeModuleName, strDataType);
            UserDefined rWeldProcedure = (UserDefined)rWeldProcedureArray.ReadItem(this.intIndex);

            rWeldProcedure.FillFromString(this.ToString());
            ErrorHandler.AddErrorMessage("MichaelLog", this.ToString());
            rWeldProcedureArray.WriteItem(rWeldProcedure, this.intIndex);

            //rWeldProcedureType.Dispose();
            rWeldProcedure.Dispose();
            rWeldProcedureArray.Dispose();
        }
        public void TestSpeedDataArray()
        {
            RapidData     rapidData     = this.controller.Rapid.GetRapidData("T_ROB1", "MainModule", "speed1");
            RapidDataType rapidDataType = controller.Rapid.GetRapidDataType("T_ROB1", "MainModule", "speed1");

            if (rapidData.IsArray)
            {
                Stopwatch stopwatch = new Stopwatch();
                stopwatch.Start();

                ArrayData arrayData = (ArrayData)rapidData.Value;
                arrayData.Mode = ArrayModes.Snapshot;
                for (int i = 0; i < arrayData.Length; i++)
                {
                    SpeedData speedData = new SpeedData(rapidDataType, arrayData[i].ToStructure());
                    //SpeedData speedData =new SpeedData(rapidDataType,rapidData.ReadItem(i).ToStructure());
                    speedData.Tcp += i;
                    rapidData.WriteItem(speedData, i);
                }

                stopwatch.Stop();
                logger.Debug(stopwatch.ElapsedMilliseconds.ToString());
            }
        }
Example #5
0
        public void WriteData(RapidData RapidName, object WriteData, int Index = 1, int Llndex = 1)
        {
            switch (RapidName.RapidType)
            {
            case "num":
                Num NumData = new Num();
                NumData.FillFromString(WriteData.ToString());
                if (RapidName.IsArray)
                {
                    if (ArrayRank(RapidName) > 1)
                    {
                        RapidName.WriteItem(NumData, Index, Llndex);
                    }
                    else
                    {
                        RapidName.WriteItem(NumData, Index);
                    }
                }
                else
                {
                    RapidName.Value = NumData;
                }
                break;

            case "bool":
                Bool BoolData = new Bool();
                BoolData.FillFromString(WriteData.ToString());
                if (RapidName.IsArray)
                {
                    if (ArrayRank(RapidName) > 1)
                    {
                        RapidName.WriteItem(BoolData, Index, Llndex);
                    }
                    else
                    {
                        RapidName.WriteItem(BoolData, Index);
                    }
                }
                else
                {
                    RapidName.Value = BoolData;
                }
                break;

            case "string":
                ABB.Robotics.Controllers.RapidDomain.String StrData = new ABB.Robotics.Controllers.RapidDomain.String();
                StrData.FillFromString(WriteData.ToString());
                if (RapidName.IsArray)
                {
                    if (ArrayRank(RapidName) > 1)
                    {
                        RapidName.WriteItem(StrData, Index, Llndex);
                    }
                    else
                    {
                        RapidName.WriteItem(StrData, Index);
                    }
                }
                else
                {
                    RapidName.Value = StrData;
                }
                break;

            default:
                break;
            }
        }