Class RapidDataType
RAPID data type descriptor.
Inherited Members
Namespace: ABB.Robotics.Controllers.RapidDomain
Assembly: ABB.Robotics.Controllers.PC.dll
Syntax
public class RapidDataType : RapidSymbol, IComparable, IRapidSymbol, INamedObject
Constructors
RapidDataType(RapidSymbol)
Initializes a new instance of RapidDataType.
Declaration
public RapidDataType(RapidSymbol symbol)
Parameters
Type | Name | Description |
---|---|---|
RapidSymbol | symbol | A rapid symbol. |
Properties
IsAtomic
Whether the data type is atomic or not.
Declaration
public bool IsAtomic { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsRecord
Whether the data type is a composite data type or not.
Declaration
public bool IsRecord { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Methods
GetComponents()
Gets the sub components of a composite data type.
Declaration
public RapidSymbol[] GetComponents()
Returns
Type | Description |
---|---|
RapidSymbol[] | Sub components of the type. Returns an empty array if the type is atomic. |
Examples
This example searches all the sub components (down to atomic types) of the robtarget data type and writes the names and the data type of each component to the console.
using ABB.Robotics;
using ABB.Robotics.Controllers;
using ABB.Robotics.Controllers.RapidDomain;
...
private void btnSearchRobtarget_Click_1(object sender, EventArgs e)
{
Controller c = new Controller();
Task tRob1 = c.Rapid.GetTask("T_ROB1");
RapidDataType theDataType;
RapidSymbol[] rsCol;
// define search properties
RapidSymbolSearchProperties sProp = RapidSymbolSearchProperties.CreateDefaultForData(true);
sProp.SearchMethod = SymbolSearchMethod.Block;
sProp.LocalSymbols = true;
// get all data of robtarget type
rsCol = tRob1.SearchRapidSymbol(sProp, "RAPID/robtarget", "");
// write the name of the first robtarget
Console.WriteLine("Symbol name = " + rsCol[0].Name);
// get data type
theDataType = RapidDataType.GetDataType(rsCol[0]);
Console.WriteLine("DataType = " + theDataType.Name); //robtarget
// get sub components of robtarget
RapidSymbol[] symbols = theDataType.GetComponents();
SearchRecordComponents(symbols);
}
private void SearchRecordComponents(RapidSymbol[] rsCol)
{
RapidDataType theDataType;
foreach (RapidSymbol rs in rsCol)
{
Console.WriteLine("Symbol name = " + rs.Name);
theDataType = RapidDataType.GetDataType(rs);
Console.WriteLine("DataType = " + theDataType.Name);
if (theDataType.IsRecord)
{
RapidSymbol[] symbols = theDataType.GetComponents();
//recursive until atomic type is found
SearchRecordComponents(symbols);
}
}
}
When the button is clicked the following lines will be written to the console:
Symbol name = p10
DataType = robtarget
Symbol name = trans
DataType = pos
Symbol name = x
DataType = num
Symbol name = y
DataType = num
Symbol name = z
DataType = num
Symbol name = rot
DataType = orient
Symbol name = q1
DataType = num
Symbol name = q2
DataType = num
Symbol name = q3
DataType = num
Symbol name = q4
DataType = num
Symbol name = robconf
DataType = confdata
Symbol name = cf1
DataType = num
Symbol name = cf4
DataType = num
Symbol name = cf6
DataType = num
Symbol name = cfx
DataType = num
Symbol name = extax
DataType = extjoint
Symbol name = eax_a
DataType = num
Symbol name = eax_b
DataType = num
Symbol name = eax_c
DataType = num
Symbol name = eax_d
DataType = num
Symbol name = eax_e
DataType = num
Symbol name = eax_f
DataType = num
GetDataType(RapidSymbol)
Gets the data type of a symbol. Exception if no data type is available, eg. for symbols such as Routine or Module.
Declaration
public static RapidDataType GetDataType(RapidSymbol symbol)
Parameters
Type | Name | Description |
---|---|---|
RapidSymbol | symbol | Symbol to get datatype of. |
Returns
Type | Description |
---|---|
RapidDataType | The data type of the symbol. |
Implements
System.IComparable