Exemple #1
0
        private void PrintRapidData(string taskName, string moduleName, string varName)
        {
            try
            {
                rdt = controller.Rapid.GetRapidDataType(taskName, moduleName, varName);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.StackTrace); Thread.Sleep(5000);
            }
            try
            {
                if (rd != null)
                {
                    rd.Dispose();
                }
                rd = controller.Rapid.GetRapidData(taskName, moduleName, varName);
            }
            catch (Exception e)
            {
                Console.WriteLine("Could not fetch rapid data");
                Console.WriteLine(e.StackTrace);
            }

            if (!string.IsNullOrWhiteSpace(rd.StringValue))
            {
                Console.WriteLine("{0} : {1} ", taskName, rd.StringValue);
            }
            // subscribing to variable change
            rd.ValueChanged += RapidVar_ValueChanged;
        }
Exemple #2
0
        public void RefreshData(RWSystem rwSystem)
        {
            RapidData     rPipeGrooveModel           = rwSystem.Controller.Rapid.GetRapidData(strTaskName, strDataModuleName, strDataName);
            RapidDataType rPipeGrooveModelType       = rwSystem.Controller.Rapid.GetRapidDataType(strTaskName, strDataTypeModuleName, strDataType);
            UserDefined   rPipeGrooveModelUserDefine = new UserDefined(rPipeGrooveModelType);

            rPipeGrooveModelUserDefine.FillFromString(rPipeGrooveModel.Value.ToString());

            int i = 0;

            this.numIndex          = int.Parse(rPipeGrooveModelUserDefine.Components[i++].ToString());
            this.numPipeGrooveType = int.Parse(rPipeGrooveModelUserDefine.Components[i++].ToString());

            this.numSeamCenterX     = decimal.Parse(rPipeGrooveModelUserDefine.Components[i++].ToString());
            this.numSeamNormalAngle = decimal.Parse(rPipeGrooveModelUserDefine.Components[i++].ToString());

            this.numHeaderDiameter  = decimal.Parse(rPipeGrooveModelUserDefine.Components[i++].ToString());
            this.numHeaderThickness = decimal.Parse(rPipeGrooveModelUserDefine.Components[i++].ToString());
            this.numHeaderMaterial  = int.Parse(rPipeGrooveModelUserDefine.Components[i++].ToString());

            this.numBranchDiameter  = decimal.Parse(rPipeGrooveModelUserDefine.Components[i++].ToString());
            this.numBranchThickness = decimal.Parse(rPipeGrooveModelUserDefine.Components[i++].ToString());
            this.numBranchMaterial  = int.Parse(rPipeGrooveModelUserDefine.Components[i++].ToString());

            this.numMultiPassTotal    = int.Parse(rPipeGrooveModelUserDefine.Components[i++].ToString());
            this.numCooperativeRobots = int.Parse(rPipeGrooveModelUserDefine.Components[i++].ToString());
            this.numPathSource        = int.Parse(rPipeGrooveModelUserDefine.Components[i++].ToString());

            this.numReviseScanBranchType = int.Parse(rPipeGrooveModelUserDefine.Components[i++].ToString());
            this.numReviseScanHeaderType = int.Parse(rPipeGrooveModelUserDefine.Components[i++].ToString());

            this.numWeldLegWidth      = decimal.Parse(rPipeGrooveModelUserDefine.Components[i++].ToString());
            this.numGrooveGap         = decimal.Parse(rPipeGrooveModelUserDefine.Components[i++].ToString());
            this.numBranchGrooveRoot  = decimal.Parse(rPipeGrooveModelUserDefine.Components[i++].ToString());
            this.numBranchGrooveAngle = decimal.Parse(rPipeGrooveModelUserDefine.Components[i++].ToString());

            this.numBranchGrooveAngle90 = decimal.Parse(rPipeGrooveModelUserDefine.Components[i++].ToString());
            this.numTopHeight90         = decimal.Parse(rPipeGrooveModelUserDefine.Components[i++].ToString());
            this.numBottomHeight90      = decimal.Parse(rPipeGrooveModelUserDefine.Components[i++].ToString());
            this.numProfCosine          = decimal.Parse(rPipeGrooveModelUserDefine.Components[i++].ToString());

            this.numLayerHeight             = decimal.Parse(rPipeGrooveModelUserDefine.Components[i++].ToString());
            this.numLayerPassTotalRoundType = decimal.Parse(rPipeGrooveModelUserDefine.Components[i++].ToString());
            this.numAlgorithmType           = int.Parse(rPipeGrooveModelUserDefine.Components[i++].ToString());

            this.boolContinuous = bool.Parse(rPipeGrooveModelUserDefine.Components[i++].ToString());
            this.boolUseAlignedSTNbyFixedValue = bool.Parse(rPipeGrooveModelUserDefine.Components[i++].ToString());

            this.strID     = rPipeGrooveModelUserDefine.Components[i++].ToString();
            this.strRemark = rPipeGrooveModelUserDefine.Components[i++].ToString();

            rPipeGrooveModelUserDefine.Dispose();
            rPipeGrooveModelType.Dispose();
            rPipeGrooveModel.Dispose();
        }
        public void Write_ABB_DataRecord(string Data_Record_Name, string Module_Name, string Task_Name, Controller aController, List <string> Variables, int ArrayIndex)
        {
            string        L_Module_Name      = Module_Name;
            string        L_Task_Name        = Task_Name;
            string        L_Data_Record_Name = Data_Record_Name;
            List <string> _Variables         = Variables;
            Controller    L_aController      = aController;
            int           _ArrayIndex        = ArrayIndex;
            string        _info;

            try
            {
                //Get the array with the records
                rd_array = aController.Rapid.GetRapidData(Task_Name, Module_Name, "RawIndividuals");
                ad       = (ArrayData)rd_array.Value;
                int aRank = ad.Rank;

                //Read the record
                rd  = L_aController.Rapid.GetRapidData(Task_Name, Module_Name, L_Data_Record_Name);
                rdt = L_aController.Rapid.GetRapidDataType(L_Task_Name, L_Module_Name, L_Data_Record_Name);
                UserDefined processdata = new UserDefined(rdt);

                //Prepare the parameters
                for (int i = 0; i < 5; i++)
                {
                    processdata.Components[i].FillFromString(_Variables[i]);
                }

                //Add the parameters to the array
                rd_array.Value = ad;
                ad[ArrayIndex] = processdata;
            }

            catch (ABB.Robotics.Controllers.RapidDomain.RapidModuleNotFoundException ee)
            {
                _info = "Error: " + ee.Message;
            }
            catch (ABB.Robotics.Controllers.RapidDomain.RapidSymbolNotFoundException ee)
            {
                _info = "Error: " + ee.Message;
            }
            catch (ABB.Robotics.GenericControllerException ee)
            {
                _info = "Error: " + ee.Message;
            }
            catch (System.Exception ee)
            {
                _info = "Error: " + ee.Message;
            }
            finally
            {
                // Release resources
            }
        }
Exemple #4
0
        public void ApplyData(RWSystem rwSystem)
        {
            RapidData     rLayerParameter           = rwSystem.Controller.Rapid.GetRapidData(strTaskName, strDataModuleName, string.Format("{0}{1:00}", strDataName, this.intLayerNo));
            RapidDataType rLayerParameterType       = rwSystem.Controller.Rapid.GetRapidDataType(strTaskName, strDataTypeModuleName, strDataType);
            UserDefined   rLayerParameterUserDefine = new UserDefined(rLayerParameterType);

            rLayerParameterUserDefine.FillFromString(this.ToString());
            ErrorHandler.AddErrorMessage("MichaelLog", this.ToString());
            rLayerParameter.Value = rLayerParameterUserDefine;

            rLayerParameterUserDefine.Dispose();
            rLayerParameterType.Dispose();
            rLayerParameter.Dispose();
        }
Exemple #5
0
        public void ApplyData(RWSystem rwSystem)
        {
            RapidData     rPipeGrooveModel           = rwSystem.Controller.Rapid.GetRapidData(strTaskName, strDataModuleName, strDataName);
            RapidDataType rPipeGrooveModelType       = rwSystem.Controller.Rapid.GetRapidDataType(strTaskName, strDataTypeModuleName, strDataType);
            UserDefined   rPipeGrooveModelUserDefine = new UserDefined(rPipeGrooveModelType);

            rPipeGrooveModelUserDefine.FillFromString(this.ToString());
            ErrorHandler.AddErrorMessage("MichaelLog", this.ToString());
            rPipeGrooveModel.Value = rPipeGrooveModelUserDefine;

            rPipeGrooveModelUserDefine.Dispose();
            rPipeGrooveModelType.Dispose();
            rPipeGrooveModel.Dispose();
        }
        //Functions


        public string Read_ABB_DataRecord(string Data_Record_Name, string Module_Name, string Task_Name, Controller aController, int ArrayIndex)
        {
            string Data_Records_Time = " ";

            string     L_Module_Name      = Module_Name;
            string     L_Task_Name        = Task_Name;
            string     L_Data_Record_Name = Data_Record_Name;
            Controller L_aController      = aController;
            string     _info;

            try
            {
                //Get the array with the records
                rd_array = aController.Rapid.GetRapidData(Task_Name, Module_Name, "RawIndividuals");
                ad       = (ArrayData)rd_array.Value;
                int aRank = ad.Rank;

                //Read the record
                rd  = L_aController.Rapid.GetRapidData(Task_Name, Module_Name, L_Data_Record_Name);
                rdt = L_aController.Rapid.GetRapidDataType(L_Task_Name, L_Module_Name, L_Data_Record_Name);
                UserDefined processdata = new UserDefined(rdt);

                processdata = (UserDefined)ad[ArrayIndex];

                //Get the time elapsed using the individual's parameters
                Data_Records_Time = processdata.Components[5].ToString();
                return(Data_Records_Time);
            }

            catch (ABB.Robotics.Controllers.RapidDomain.RapidModuleNotFoundException ee)
            {
                return(_info = "Error: " + ee.Message);
            }
            catch (ABB.Robotics.Controllers.RapidDomain.RapidSymbolNotFoundException ee)
            {
                return(_info = "Error: " + ee.Message);
            }
            catch (ABB.Robotics.GenericControllerException ee)
            {
                return(_info = "Error: " + ee.Message);
            }
            catch (System.Exception ee)
            {
                return(_info = "Error: " + ee.Message);
            }
            finally
            {
                //
            }
        }
Exemple #7
0
        public void RefreshData(RWSystem rwSystem, string strCircle)
        {
            RapidDataType rCircleType       = rwSystem.Controller.Rapid.GetRapidDataType(strTaskName, strDataTypeModuleName, strDataType);
            UserDefined   rCircleUserDefine = new UserDefined(rCircleType);

            rCircleUserDefine.FillFromString(strCircle);

            int i = 0;

            this.numDegree0 = decimal.Parse(rCircleUserDefine.Components[i++].ToString());
            //ErrorHandler.AddErrorMessage("MichaelLog", rCircleUserDefine.Components[i].ToString());
            this.numDegree90  = decimal.Parse(rCircleUserDefine.Components[i++].ToString());
            this.numDegree180 = decimal.Parse(rCircleUserDefine.Components[i++].ToString());
            this.numDegree270 = decimal.Parse(rCircleUserDefine.Components[i++].ToString());
            this.numCurveType = int.Parse(rCircleUserDefine.Components[i++].ToString());

            rCircleUserDefine.Dispose();
            rCircleType.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());
            }
        }
Exemple #9
0
        public void RefreshData(RWSystem rwSystem, int intLayerNo)
        {
            this.intLayerNo = intLayerNo;

            RapidData     rLayerParameter           = rwSystem.Controller.Rapid.GetRapidData(strTaskName, strDataModuleName, string.Format("{0}{1:00}", strDataName, this.intLayerNo));
            RapidDataType rLayerParameterType       = rwSystem.Controller.Rapid.GetRapidDataType(strTaskName, strDataTypeModuleName, strDataType);
            UserDefined   rLayerParameterUserDefine = new UserDefined(rLayerParameterType);

            rLayerParameterUserDefine.FillFromString(rLayerParameter.Value.ToString());

            int i = 0;

            this.numWorkAngleDeclination = int.Parse(rLayerParameterUserDefine.Components[i++].ToString());
            //ErrorHandler.AddErrorMessage("MichaelLog", rLayerParameterUserDefine.Components[i].ToString());

            this.rCircleOffsetX.RefreshData(rwSystem, rLayerParameterUserDefine.Components[i++].ToString());
            this.rCircleOffsetZ.RefreshData(rwSystem, rLayerParameterUserDefine.Components[i++].ToString());
            this.rCircleRotationX.RefreshData(rwSystem, rLayerParameterUserDefine.Components[i++].ToString());
            this.rCircleRotationY.RefreshData(rwSystem, rLayerParameterUserDefine.Components[i++].ToString());
            this.rCircleRotationZ.RefreshData(rwSystem, rLayerParameterUserDefine.Components[i++].ToString());

            this.strLayerParameterID = rLayerParameterUserDefine.Components[i++].ToString();
            this.strLayerParameterID = this.strLayerParameterID.Substring(1, this.strLayerParameterID.Length - 2);

            rLayerParameterUserDefine.Dispose();
            rLayerParameterType.Dispose();
            rLayerParameter.Dispose();

            //DataRow row = this.CircleTable.Rows.Find("OffsetX");
            //row[1] = this.circleOffsetX.numDegree0;
            //row[2] = this.circleOffsetX.numDegree90;
            //row[3] = this.circleOffsetX.numDegree180;
            //row[4] = this.circleOffsetX.numDegree270;
            //row[5] = this.circleOffsetX.numCurveType;

            //row = this.CircleTable.Rows.Find("OffsetZ");
            //row[1] = this.circleOffsetZ.numDegree0;
            //row[2] = this.circleOffsetZ.numDegree90;
            //row[3] = this.circleOffsetZ.numDegree180;
            //row[4] = this.circleOffsetZ.numDegree270;
            //row[5] = this.circleOffsetZ.numCurveType;

            //row = this.CircleTable.Rows.Find("RotationX");
            //row[1] = this.circleRotationX.numDegree0;
            //row[2] = this.circleRotationX.numDegree90;
            //row[3] = this.circleRotationX.numDegree180;
            //row[4] = this.circleRotationX.numDegree270;
            //row[5] = this.circleRotationX.numCurveType;

            //row = this.CircleTable.Rows.Find("RotationY");
            //row[1] = this.circleRotationY.numDegree0;
            //row[2] = this.circleRotationY.numDegree90;
            //row[3] = this.circleRotationY.numDegree180;
            //row[4] = this.circleRotationY.numDegree270;
            //row[5] = this.circleRotationY.numCurveType;

            //row = this.CircleTable.Rows.Find("RotationZ");
            //row[1] = this.circleRotationZ.numDegree0;
            //row[2] = this.circleRotationZ.numDegree90;
            //row[3] = this.circleRotationZ.numDegree180;
            //row[4] = this.circleRotationZ.numDegree270;
            //row[5] = this.circleRotationZ.numCurveType;
        }
 public SpeedData(RapidDataType rdt, string newValue)
 {
     this.data = new UserDefined(rdt);
     this.data.FillFromString2(newValue);
 }
 public SpeedData(RapidDataType rdt, DataNode root)
 {
     this.data = new UserDefined(rdt);
     this.data.Fill2(root);
 }
 public SpeedData(RapidDataType rdt)
 {
     this.data = new UserDefined(rdt);
     this.data.FillFromString2("[0,0,0,0]");
 }