Click or drag to resize

RapidGetRapidData Method

Gets a RapidData object that references a RAPID data instance in the robot controller.

Namespace:  ABB.Robotics.Controllers.RapidDomain
Assembly:  ABB.Robotics.Controllers (in ABB.Robotics.Controllers.dll) Version: 6.5.129.0
Syntax
C#
public RapidData GetRapidData(
	params string[] rapidData
)

Parameters

rapidData
Type: SystemString
An array of strings, which specifies where in the RAPID domain the RAPID data is declared.

Return Value

Type: RapidData
A RapidData object to access the RAPID data. If the RAPID data instance does not exist, the return value is null.
Exceptions
ExceptionCondition
GeneralExceptionA General Exception has occurred.
ArgumentNullExceptionrapidData is null or empty.
Remarks
If the name of the declaring module is unknown SearchRapidSymbol(RapidSymbolSearchProperties, String, String) can be used to retrieve the RapidData object. NOTE:When the RapidData instance is no longer needed you must call its Dispose method.
Examples
The example below creates a RapidData object of the RAPID data instance reg1, which is declared in the RAPID task T_ROB1 in the USER module. The value of reg1 is written to a textbox.
private void DisplayValueOfReg1()
{
    RapidData rdReg1;
    try
    {
        // Create Controller if not created
        if (_controller == null)
            _controller = new Controller();

        // Create RapidData object for reg1
        rdReg1 = _controller.Rapid.GetRapidData("T_ROB1","USER","reg1");

        // Get value of reg1 as a Num 
        Num nValOfReg1 = (Num) rdReg1.Value;

        // Display value of 
        textBox1.Text = nValOfReg1.ToString();
    }
    catch (GeneralException ee)
    {
        // TODO: Implement error handling here
    }
    catch (System.Exception ee)
    {
        // TODO: Implement error handling here
    }
    finally
    {
        // Make sure rdReg1 is dispoed
        if (rdReg1 != null)
            rdReg1.Dispose();
    }    
}
See Also