Click or drag to resize

RapidDataWriteItem Method

Writes 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 void WriteItem(
	IRapidData newValue,
	params int[] index
)

Parameters

newValue
Type: ABB.Robotics.Controllers.RapidDomainIRapidData
A IRapidData instance that contains the new value of the rapid data.
index
Type: SystemInt32
Index of the item.
Exceptions
ExceptionCondition
IndexOutOfRangeExceptionindex The index is not valid for the data.
InvalidOperationExceptionRapid data is not an array.
ArgumentNullExceptionnewValue is null or represents an empty string.
GeneralExceptionA General Exception has occurred.
Examples
This example reads an robtarget array and the value of the X-orientation is increased by one for each item.
private void IncXOrientation(Conroller c)
{
    try
    {
        // Create RapidData instance to 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);

            // Increase X
            rtValue.Trans.X += 1;

            // Apply new value to Rapid data in controller
            rdRobtarget.WriteItem(rtValue,i);
        }
    }
    catch (GeneralException ee)
    {
        // TODO: Add error handling
    }
    catch (System.Exception ee)
    {
        // TODO: Add error handling
    }
    finally
    {
        if (rdRobtarget != null)
            rdRobtarget.Dispose();
    }
}
See Also