Click or drag to resize
RsGenericDataDeclaration Class
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 Hierarchy

Namespace:  ABB.Robotics.RobotStudio.Stations
Assembly:  ABB.Robotics.RobotStudio.Stations (in ABB.Robotics.RobotStudio.Stations.dll) Version: 7.0.8747.636
Syntax
C#
public sealed class RsGenericDataDeclaration : RsDataDeclaration

The RsGenericDataDeclaration type exposes the following members.

Constructors
  NameDescription
Public methodCode exampleRsGenericDataDeclaration(String, String)
Initializes a new instance of the RsGenericDataDeclaration class.
Public methodCode exampleRsGenericDataDeclaration(String, String, Int32)
Initializes a new instance of the RsGenericDataDeclaration class as an array with 1-3 dimensions.
Top
Properties
  NameDescription
Public propertyAttributes
Returns a collection of dynamic attributes attached to the object
(Inherited from ProjectObject.)
Public propertyChildren
Enumerates all child objects.
(Inherited from ProjectObject.)
Public propertyContainingProject
Returns the Project that this object is a part of, or null if it is not part of a Project.
(Inherited from ProjectObject.)
Public propertyCode exampleDataType
Gets the RAPID data type of the Data Declaration.
(Inherited from RsDataDeclaration.)
Public propertyDisplayName (Inherited from RsDataDeclaration.)
Public propertyCode exampleInitialExpression
Gets or sets the InitialExpression of the DataDeclaration.
Public propertyLocal
Gets or sets if the DataDeclaration is declared local in a module. (Corresponds to the LOCAL keyword in RAPID).
(Inherited from RsDataDeclaration.)
Public propertyModuleName
Gets or sets the name of the RAPID module that the DataDeclaration will be synchronized to.
(Inherited from RsDataDeclaration.)
Public propertyName
Gets or sets the name of the DataDeclaration
(Inherited from RsDataDeclaration.)
Public propertyParent
Returns the objects parent, if it has one.
(Inherited from ProjectObject.)
Public propertyStorageType
Gets or sets the RapidStorageType of the DataDeclaration
(Inherited from RsDataDeclaration.)
Public propertySynchronize
Gets or sets whether the DataDeclaration should be synchronized to the VC when the referencing RsPathProcedure is.
(Inherited from RsDataDeclaration.)
Public propertyTypeDisplayName
Gets a localized name for the type of this object.
(Inherited from ProjectObject.)
Public propertyUIVisible
Gets or sets a value that indicates if this object should be displayed in GUI such as an object browser.
(Inherited from ProjectObject.)
Public propertyUniqueId
Gets a persisted, globally unique identifier for this object, that can be used to find the object using the GetObjectFromUniqueId(String) method.
(Inherited from ProjectObject.)
Top
Methods
  NameDescription
Public methodCopy
Creates a copy of the DataDeclaration.
(Inherited from RsDataDeclaration.)
Public methodEquals (Inherited from Object.)
Public methodFindObjects
Recursively finds object that satisfy a condition.
(Inherited from ProjectObject.)
Public methodCode exampleGetDimensions
Gets the dimensions of the DataDeclaration.
Public methodGetHashCode (Inherited from Object.)
Public methodGetReferencingInstructions
Returns all RsInstructions that are referencing this DataDeclaration.
(Inherited from RsDataDeclaration.)
Public methodGetType (Inherited from Object.)
Public methodToString (Inherited from ProjectObject.)
Top
Examples
Frame Example.
RsGenericDataDeclaration Properties 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();
}
Version Information

Supported in: 1.0.0.0
See Also