Search Results for

    Show / Hide Table of Contents

    ReadItem and WriteItem methods

    Overview

    An alternative way of accessing RAPID data stored in an array are the ReadItem and WriteItem methods.

    ReadItem method

    Using the ReadItem method you can directly access a RapidData item in an array, for example an array with RobTargets or Nums. The index to the item is explicitly specified in the ReadItem call. The first item is in position 1, that is, the array is 1-based as in RAPID.

    Num aNum = (Num)rd.ReadItem(1, 2);
    

    This example retrieves the second Num value in the first array of the RAPID data variable referenced by rd.

    WriteItem method

    It is possible to use the WriteItem method to write to an individual RAPID data item in an array. The following example shows how to write the result of an individual robot operation into an array representing a total robot program with several operations:

    Num aNum = new Num(OPERATION_OK);
    rd.WriteItem(aNum, 1, 2);
    
    Note

    If the index is not in the range specified, an IndexOutOfRangeException will be thrown.

    In This Article
    Back to top Copyright © 2025 ABB