Search Results for

    Show / Hide Table of Contents

    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.

    Inheritance
    object
    ProjectObject
    RsDataDeclaration
    RsGenericDataDeclaration
    Implements
    ISupportCopy
    Inherited Members
    RsDataDeclaration.Copy()
    RsDataDeclaration.GetReferencingInstructions()
    RsDataDeclaration.Name
    RsDataDeclaration.DisplayName
    RsDataDeclaration.Synchronize
    RsDataDeclaration.ModuleName
    RsDataDeclaration.StorageType
    RsDataDeclaration.Local
    RsDataDeclaration.DataType
    ProjectObject.FindObjects(Predicate<ProjectObject>, Predicate<ProjectObject>)
    ProjectObject.ToString()
    ProjectObject.Parent
    ProjectObject.ContainingProject
    ProjectObject.Attributes
    ProjectObject.UIVisible
    ProjectObject.TypeDisplayName
    ProjectObject.UniqueId
    ProjectObject.Children
    ProjectObject.DisplayNameChanged
    ProjectObject.ProjectObjectChanged
    ProjectObject.InternalEvent
    Namespace: ABB.Robotics.RobotStudio.Stations
    Assembly: ABB.Robotics.RobotStudio.Stations.dll
    Syntax
    public sealed class RsGenericDataDeclaration : RsDataDeclaration, ISupportCopy
    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();
            }</code></pre>
    

    Constructors

    View Source

    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();
            }</code></pre>
    
    View Source

    RsGenericDataDeclaration(string, string, int[])

    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.

    int[] 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();
            }</code></pre>
    

    Properties

    View Source

    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();
            }</code></pre>
    

    Methods

    View Source

    GetDimensions()

    Gets the dimensions of the DataDeclaration.

    Declaration
    public int[] GetDimensions()
    Returns
    Type Description
    int[]

    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();
            }</code></pre>
    

    Implements

    ISupportCopy
    • View Source
    In this article
    Back to top Copyright © 2026 ABB Robotics