Class RsGenericDataDeclaration
Represents a RAPID DataDeclaration that does not have dedicated class in the RobotStudio API, but that still should be possible to syncronize and/or modify.
Implements
Inherited Members
Namespace: ABB.Robotics.RobotStudio.Stations
Assembly: ABB.Robotics.RobotStudio.Stations.dll
Syntax
public sealed class RsGenericDataDeclaration : RsDataDeclaration, ISupportCopy, IDeclaration
Examples
Frame Example.
Project.UndoContext.BeginUndoStep("RsGenericDataDeclarationProperties");
try
{
// ***This example requires a running VC***
Station station = Station.ActiveStation;
// Create a GenericDataDeclaration, representing a string value.
RsGenericDataDeclaration myGenDDString = new RsGenericDataDeclaration("myString", "string");
// Set the InitialExpression of the DataDeclaration.
myGenDDString.InitialExpression = "\"some_value\"";
// Set the module name the DataDeclaration should be syncronized to.
myGenDDString.ModuleName = "myModule_1";
// Define the DataDeclaration as variable.
myGenDDString.StorageType = RapidStorageType.Variable;
// Make sure the DataDeclaration is synchroinized when the task is.
myGenDDString.Synchronize = true;
// Add the DataDeclaration to the ActiveTask.
station.ActiveTask.DataDeclarations.Add(myGenDDString);
// Syncronize the DataDeclarations to the VC.
System.Collections.Generic.List<SyncLogMessage> syncLog_1 = new System.Collections.Generic.List<SyncLogMessage>();
await station.ActiveTask.SyncDataAsync(myGenDDString.ModuleName + "/" + myGenDDString.Name, SyncDirection.ToController, syncLog_1);
// Create a genric DataDeclaration, representing a 3-dimensional matrix
// where each dimension has 3 entries.
int[] dimensions = new int[3] { 3, 3, 3 };
RsGenericDataDeclaration myGenDDMatrix = new RsGenericDataDeclaration("myMatrix", "num", dimensions);
// Set the InitialExpression of the DataDeclaration.
myGenDDMatrix.InitialExpression = "[[[1,0,1],[0,0,1],[1,1,2]],[[1,2,1],[1,2,2],[1,1,3]],[[1,4,1],[1,1,2],[1,1,3]]]";
// Set the module name the DataDeclaration should be syncronized to.
myGenDDMatrix.ModuleName = "myModule_2";
// Define the DataDeclaration as persistent.
myGenDDMatrix.StorageType = RapidStorageType.TaskPersistent;
// Make sure the DataDeclaration is synchroinized when the task is.
myGenDDMatrix.Synchronize = true;
// Add the DataDeclaration to the ActiveTask.
station.ActiveTask.DataDeclarations.Add(myGenDDMatrix);
// Syncronize the DataDeclarations to the VC.
System.Collections.Generic.List<SyncLogMessage> syncLog_2 = new System.Collections.Generic.List<SyncLogMessage>();
await station.ActiveTask.SyncDataAsync(myGenDDMatrix.ModuleName + "/" + myGenDDMatrix.Name, SyncDirection.ToController, syncLog_2);
}
catch
{
Project.UndoContext.CancelUndoStep(CancelUndoStepType.Rollback);
throw;
}
finally
{
Project.UndoContext.EndUndoStep();
}
Constructors
RsGenericDataDeclaration(String, String)
Initializes a new instance of the RsGenericDataDeclaration class.
Declaration
public RsGenericDataDeclaration(string name, string dataType)
Parameters
Type | Name | Description |
---|---|---|
String | name | The RAPID name of the declaration. |
String | dataType | The RAPID data type of the declaration |
Examples
Create RsGenericDataDeclaration.
Project.UndoContext.BeginUndoStep("RsGenericDataDeclarationProperties");
try
{
// ***This example requires a running VC***
Station station = Station.ActiveStation;
// Create a GenericDataDeclaration, representing a string value.
RsGenericDataDeclaration myGenDDString = new RsGenericDataDeclaration("myString", "string");
// Set the InitialExpression of the DataDeclaration.
myGenDDString.InitialExpression = "\"some_value\"";
// Set the module name the DataDeclaration should be syncronized to.
myGenDDString.ModuleName = "myModule_1";
// Define the DataDeclaration as variable.
myGenDDString.StorageType = RapidStorageType.Variable;
// Make sure the DataDeclaration is synchroinized when the task is.
myGenDDString.Synchronize = true;
// Add the DataDeclaration to the ActiveTask.
station.ActiveTask.DataDeclarations.Add(myGenDDString);
// Syncronize the DataDeclarations to the VC.
System.Collections.Generic.List<SyncLogMessage> syncLog_1 = new System.Collections.Generic.List<SyncLogMessage>();
await station.ActiveTask.SyncDataAsync(myGenDDString.ModuleName + "/" + myGenDDString.Name, SyncDirection.ToController, syncLog_1);
// Create a genric DataDeclaration, representing a 3-dimensional matrix
// where each dimension has 3 entries.
int[] dimensions = new int[3] { 3, 3, 3 };
RsGenericDataDeclaration myGenDDMatrix = new RsGenericDataDeclaration("myMatrix", "num", dimensions);
// Set the InitialExpression of the DataDeclaration.
myGenDDMatrix.InitialExpression = "[[[1,0,1],[0,0,1],[1,1,2]],[[1,2,1],[1,2,2],[1,1,3]],[[1,4,1],[1,1,2],[1,1,3]]]";
// Set the module name the DataDeclaration should be syncronized to.
myGenDDMatrix.ModuleName = "myModule_2";
// Define the DataDeclaration as persistent.
myGenDDMatrix.StorageType = RapidStorageType.TaskPersistent;
// Make sure the DataDeclaration is synchroinized when the task is.
myGenDDMatrix.Synchronize = true;
// Add the DataDeclaration to the ActiveTask.
station.ActiveTask.DataDeclarations.Add(myGenDDMatrix);
// Syncronize the DataDeclarations to the VC.
System.Collections.Generic.List<SyncLogMessage> syncLog_2 = new System.Collections.Generic.List<SyncLogMessage>();
await station.ActiveTask.SyncDataAsync(myGenDDMatrix.ModuleName + "/" + myGenDDMatrix.Name, SyncDirection.ToController, syncLog_2);
}
catch
{
Project.UndoContext.CancelUndoStep(CancelUndoStepType.Rollback);
throw;
}
finally
{
Project.UndoContext.EndUndoStep();
}
RsGenericDataDeclaration(String, String, Int32[])
Initializes a new instance of the RsGenericDataDeclaration class as an array with 1-3 dimensions.
Declaration
public RsGenericDataDeclaration(string name, string dataType, int[] dimensions)
Parameters
Type | Name | Description |
---|---|---|
String | name | The RAPID name of the declaration. |
String | dataType | The RAPID data type of the declaration. |
Int32[] | dimensions | An array of length 1-3 that specifies the size of the array data in each dimension. |
Examples
Create RsGenericDataDeclaration.
Project.UndoContext.BeginUndoStep("RsGenericDataDeclarationProperties");
try
{
// ***This example requires a running VC***
Station station = Station.ActiveStation;
// Create a GenericDataDeclaration, representing a string value.
RsGenericDataDeclaration myGenDDString = new RsGenericDataDeclaration("myString", "string");
// Set the InitialExpression of the DataDeclaration.
myGenDDString.InitialExpression = "\"some_value\"";
// Set the module name the DataDeclaration should be syncronized to.
myGenDDString.ModuleName = "myModule_1";
// Define the DataDeclaration as variable.
myGenDDString.StorageType = RapidStorageType.Variable;
// Make sure the DataDeclaration is synchroinized when the task is.
myGenDDString.Synchronize = true;
// Add the DataDeclaration to the ActiveTask.
station.ActiveTask.DataDeclarations.Add(myGenDDString);
// Syncronize the DataDeclarations to the VC.
System.Collections.Generic.List<SyncLogMessage> syncLog_1 = new System.Collections.Generic.List<SyncLogMessage>();
await station.ActiveTask.SyncDataAsync(myGenDDString.ModuleName + "/" + myGenDDString.Name, SyncDirection.ToController, syncLog_1);
// Create a genric DataDeclaration, representing a 3-dimensional matrix
// where each dimension has 3 entries.
int[] dimensions = new int[3] { 3, 3, 3 };
RsGenericDataDeclaration myGenDDMatrix = new RsGenericDataDeclaration("myMatrix", "num", dimensions);
// Set the InitialExpression of the DataDeclaration.
myGenDDMatrix.InitialExpression = "[[[1,0,1],[0,0,1],[1,1,2]],[[1,2,1],[1,2,2],[1,1,3]],[[1,4,1],[1,1,2],[1,1,3]]]";
// Set the module name the DataDeclaration should be syncronized to.
myGenDDMatrix.ModuleName = "myModule_2";
// Define the DataDeclaration as persistent.
myGenDDMatrix.StorageType = RapidStorageType.TaskPersistent;
// Make sure the DataDeclaration is synchroinized when the task is.
myGenDDMatrix.Synchronize = true;
// Add the DataDeclaration to the ActiveTask.
station.ActiveTask.DataDeclarations.Add(myGenDDMatrix);
// Syncronize the DataDeclarations to the VC.
System.Collections.Generic.List<SyncLogMessage> syncLog_2 = new System.Collections.Generic.List<SyncLogMessage>();
await station.ActiveTask.SyncDataAsync(myGenDDMatrix.ModuleName + "/" + myGenDDMatrix.Name, SyncDirection.ToController, syncLog_2);
}
catch
{
Project.UndoContext.CancelUndoStep(CancelUndoStepType.Rollback);
throw;
}
finally
{
Project.UndoContext.EndUndoStep();
}
Properties
InitialExpression
Gets or sets the InitialExpression of the DataDeclaration.
Declaration
public string InitialExpression { get; set; }
Property Value
Type | Description |
---|---|
String |
Examples
Get/Set InitialExpression.
Project.UndoContext.BeginUndoStep("RsGenericDataDeclarationProperties");
try
{
// ***This example requires a running VC***
Station station = Station.ActiveStation;
// Create a GenericDataDeclaration, representing a string value.
RsGenericDataDeclaration myGenDDString = new RsGenericDataDeclaration("myString", "string");
// Set the InitialExpression of the DataDeclaration.
myGenDDString.InitialExpression = "\"some_value\"";
// Set the module name the DataDeclaration should be syncronized to.
myGenDDString.ModuleName = "myModule_1";
// Define the DataDeclaration as variable.
myGenDDString.StorageType = RapidStorageType.Variable;
// Make sure the DataDeclaration is synchroinized when the task is.
myGenDDString.Synchronize = true;
// Add the DataDeclaration to the ActiveTask.
station.ActiveTask.DataDeclarations.Add(myGenDDString);
// Syncronize the DataDeclarations to the VC.
System.Collections.Generic.List<SyncLogMessage> syncLog_1 = new System.Collections.Generic.List<SyncLogMessage>();
await station.ActiveTask.SyncDataAsync(myGenDDString.ModuleName + "/" + myGenDDString.Name, SyncDirection.ToController, syncLog_1);
// Create a genric DataDeclaration, representing a 3-dimensional matrix
// where each dimension has 3 entries.
int[] dimensions = new int[3] { 3, 3, 3 };
RsGenericDataDeclaration myGenDDMatrix = new RsGenericDataDeclaration("myMatrix", "num", dimensions);
// Set the InitialExpression of the DataDeclaration.
myGenDDMatrix.InitialExpression = "[[[1,0,1],[0,0,1],[1,1,2]],[[1,2,1],[1,2,2],[1,1,3]],[[1,4,1],[1,1,2],[1,1,3]]]";
// Set the module name the DataDeclaration should be syncronized to.
myGenDDMatrix.ModuleName = "myModule_2";
// Define the DataDeclaration as persistent.
myGenDDMatrix.StorageType = RapidStorageType.TaskPersistent;
// Make sure the DataDeclaration is synchroinized when the task is.
myGenDDMatrix.Synchronize = true;
// Add the DataDeclaration to the ActiveTask.
station.ActiveTask.DataDeclarations.Add(myGenDDMatrix);
// Syncronize the DataDeclarations to the VC.
System.Collections.Generic.List<SyncLogMessage> syncLog_2 = new System.Collections.Generic.List<SyncLogMessage>();
await station.ActiveTask.SyncDataAsync(myGenDDMatrix.ModuleName + "/" + myGenDDMatrix.Name, SyncDirection.ToController, syncLog_2);
}
catch
{
Project.UndoContext.CancelUndoStep(CancelUndoStepType.Rollback);
throw;
}
finally
{
Project.UndoContext.EndUndoStep();
}
Methods
GetDimensions()
Gets the dimensions of the DataDeclaration.
Declaration
public int[] GetDimensions()
Returns
Type | Description |
---|---|
Int32[] | An array of length 0-3 that specifies the size of the data in each dimension. |
Examples
GetDimensions.
Project.UndoContext.BeginUndoStep("RsGenericDataDeclarationProperties");
try
{
// ***This example requires a running VC***
Station station = Station.ActiveStation;
// Create a GenericDataDeclaration, representing a string value.
RsGenericDataDeclaration myGenDDString = new RsGenericDataDeclaration("myString", "string");
// Set the InitialExpression of the DataDeclaration.
myGenDDString.InitialExpression = "\"some_value\"";
// Set the module name the DataDeclaration should be syncronized to.
myGenDDString.ModuleName = "myModule_1";
// Define the DataDeclaration as variable.
myGenDDString.StorageType = RapidStorageType.Variable;
// Make sure the DataDeclaration is synchroinized when the task is.
myGenDDString.Synchronize = true;
// Add the DataDeclaration to the ActiveTask.
station.ActiveTask.DataDeclarations.Add(myGenDDString);
// Syncronize the DataDeclarations to the VC.
System.Collections.Generic.List<SyncLogMessage> syncLog_1 = new System.Collections.Generic.List<SyncLogMessage>();
await station.ActiveTask.SyncDataAsync(myGenDDString.ModuleName + "/" + myGenDDString.Name, SyncDirection.ToController, syncLog_1);
// Create a genric DataDeclaration, representing a 3-dimensional matrix
// where each dimension has 3 entries.
int[] dimensions = new int[3] { 3, 3, 3 };
RsGenericDataDeclaration myGenDDMatrix = new RsGenericDataDeclaration("myMatrix", "num", dimensions);
// Set the InitialExpression of the DataDeclaration.
myGenDDMatrix.InitialExpression = "[[[1,0,1],[0,0,1],[1,1,2]],[[1,2,1],[1,2,2],[1,1,3]],[[1,4,1],[1,1,2],[1,1,3]]]";
// Set the module name the DataDeclaration should be syncronized to.
myGenDDMatrix.ModuleName = "myModule_2";
// Define the DataDeclaration as persistent.
myGenDDMatrix.StorageType = RapidStorageType.TaskPersistent;
// Make sure the DataDeclaration is synchroinized when the task is.
myGenDDMatrix.Synchronize = true;
// Add the DataDeclaration to the ActiveTask.
station.ActiveTask.DataDeclarations.Add(myGenDDMatrix);
// Syncronize the DataDeclarations to the VC.
System.Collections.Generic.List<SyncLogMessage> syncLog_2 = new System.Collections.Generic.List<SyncLogMessage>();
await station.ActiveTask.SyncDataAsync(myGenDDMatrix.ModuleName + "/" + myGenDDMatrix.Name, SyncDirection.ToController, syncLog_2);
}
catch
{
Project.UndoContext.CancelUndoStep(CancelUndoStepType.Rollback);
throw;
}
finally
{
Project.UndoContext.EndUndoStep();
}