TaskGetRapidData Method |
Namespace: ABB.Robotics.Controllers.RapidDomain
public RapidData GetRapidData( params string[] rapidData )
Exception | Condition |
---|---|
GeneralException | A General Exception has occurred. |
ArgumentNullException | rapidData is null or length is less then 1 |
To access RAPID data in a shared module use the name of the data as parameter, see the second example below.
NOTE! RAPID data declared in a -Shared -Hidden module cannot be accessed.
private int SumOfAllReg1(Controller c) { int result = 0; try { // Get all tasks Task[] tasks = c.Rapid.GetTasks(); foreach (Task t in tasks) { RapidData rdReg1 = t.GetRapidData("USER","reg1"); result += int.Parse(rdReg1.Value.ToString()); } } catch (GeneralException ee) { // TODO: Add error handling } catch (System.Exception ee) { // TODO: Add error handling } finally { // Release resources } return result; }
This example gets the shared RAPID data nMessageID seen from task T_ROB1.
private RapidData GetMessageID() { RapidData rData = null; Task tRob1 = null; try { // Create temporary controller object to get task using (Controller c = new Controller()) { tRob1 = c.Rapid.GetTask("T_ROB1"); if (tRob1 != null) { // Only send one parameter to get shared data rData = tRob1.GetRapidData("nMessageID"); } else { // No task to search from } } } catch (GeneralException ge) { // TODO: Add error handling } catch (System.Exception se) { // TODO: Add error handling } finally { // Release temporary resources if (tRob1 != null) { tRob1.Dispose(); tRob1 = null; } } return rData; }