Click or drag to resize

RapidDataReadItem Method

Reads an item of the Rapid data array

Namespace:  ABB.Robotics.Controllers.RapidDomain
Assembly:  ABB.Robotics.Controllers (in ABB.Robotics.Controllers.dll) Version: 6.5.129.0
Syntax
C#
public IRapidData ReadItem(
	params int[] index
)

Parameters

index
Type: SystemInt32
Index of the item.

Return Value

Type: IRapidData
Returns a IRapidData instance that contains the value of the item.
Exceptions
ExceptionCondition
IndexOutOfRangeExceptionindex The index is not valid for the data.
InvalidOperationExceptionRapid data is not an array.
GeneralExceptionA General Exception has occurred.
Examples
This example reads each item of an robtarget array and adds the value to a listbox.
private void ShowRobtargetArrayValues(Conroller c)
{
    try
    {
        // Create RapidData instance of RAPID array
        RapidData rdRobtarget = c.Rapid.GetRapidData("T_ROB1","MyModule","rt_array");

        // Values are added in reverse order
        for (int i = 5;i > 0;i--)
        {
            // Get value of item
            RobTarget rtValue = (RobTarget) rdRobtarget.ReadItem(i);

            listBox1.Items.Add(rtValue.ToString());
        }
    }
    catch (GeneralException ee)
    {
        // TODO: Add error handling
    }
    catch (System.Exception ee)
    {
        // TODO: Add error handling
    }
    finally
    {
        if (rdRobtarget != null)
            rdRobtarget.Dispose();
    }
}
See Also