Show / Hide Table of Contents

Class RsWorkObject

A workobject is a coordinate system used to describe the position of a work piece. The workobject consists of two frames: a user frame and an object frame. All programed positions will be related to the object frame, which is related to the user frame, which is related to the world coordinate system. It corresponds to the 'workobject' data type in RAPID.

Inheritance
object
ProjectObject
RsDataDeclaration
RsWorkObject
Implements
ISupportCopy
IAttachableChild
Inherited Members
RsDataDeclaration.GetReferencingInstructions()
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 RsWorkObject : RsDataDeclaration, ISupportCopy, IAttachableChild
Examples

RsWorkObject Example.

Project.UndoContext.BeginUndoStep("RsWorkObjectExample");
try
{
Station station = Station.ActiveStation;
            // Create a RsWorkObject.
            RsWorkObject myWobj = new RsWorkObject();

            // Get a valid RAPID name for the workobject and assign it.
            myWobj.Name = station.ActiveTask.GetValidRapidName("myWobj", "_", 1);

            // Set the frame size to twice the default size.
            myWobj.FrameSize = myWobj.FrameSize * 2;

            // Set the userframe to be a fixed coordinate system.
            myWobj.UserFrameProgrammed = true;

            // Translate the user frame.
            myWobj.UserFrame.X = 0.5;
            myWobj.UserFrame.Y = 0.2;
            myWobj.UserFrame.Z = 0.2;

            // Translate the object frame.
            myWobj.ObjectFrame.X = 0.5;
            myWobj.ObjectFrame.Y = 0.5;
            myWobj.ObjectFrame.Z = 0.5;

            // Rotate the object frame (pi radians around each axis).
            myWobj.ObjectFrame.RX = System.Math.PI;
            myWobj.ObjectFrame.RY = System.Math.PI;
            myWobj.ObjectFrame.RZ = System.Math.PI;

            // Display the wobj in the graphics.
            myWobj.Visible = true;

            // Display the name of the wobj in the graphics.
            myWobj.ShowName = true;

            // The wobj is not held by the robot.
            myWobj.RobotHold = false;

            // Add the wobj to the DataDeclarations of the ActiveTask.
            station.ActiveTask.DataDeclarations.Add(myWobj);

            // Set the wobj as the active workobject of the ActiveTask.
            station.ActiveTask.ActiveWorkObject = (RsWorkObject)station.ActiveTask.FindDataDeclarationFromModuleScope(myWobj.Name, myWobj.ModuleName);
        }
        catch
        {
            Project.UndoContext.CancelUndoStep(CancelUndoStepType.Rollback);
            throw;
        }
        finally
        {
            Project.UndoContext.EndUndoStep();
        }</code></pre>

Constructors

View Source

RsWorkObject()

Initializes a new instance of the RsWorkObject class.

Declaration
public RsWorkObject()
Examples

Create RsWorkObject.

Project.UndoContext.BeginUndoStep("RsWorkObjectExample");
try
{
Station station = Station.ActiveStation;
            // Create a RsWorkObject.
            RsWorkObject myWobj = new RsWorkObject();

            // Get a valid RAPID name for the workobject and assign it.
            myWobj.Name = station.ActiveTask.GetValidRapidName("myWobj", "_", 1);

            // Set the frame size to twice the default size.
            myWobj.FrameSize = myWobj.FrameSize * 2;

            // Set the userframe to be a fixed coordinate system.
            myWobj.UserFrameProgrammed = true;

            // Translate the user frame.
            myWobj.UserFrame.X = 0.5;
            myWobj.UserFrame.Y = 0.2;
            myWobj.UserFrame.Z = 0.2;

            // Translate the object frame.
            myWobj.ObjectFrame.X = 0.5;
            myWobj.ObjectFrame.Y = 0.5;
            myWobj.ObjectFrame.Z = 0.5;

            // Rotate the object frame (pi radians around each axis).
            myWobj.ObjectFrame.RX = System.Math.PI;
            myWobj.ObjectFrame.RY = System.Math.PI;
            myWobj.ObjectFrame.RZ = System.Math.PI;

            // Display the wobj in the graphics.
            myWobj.Visible = true;

            // Display the name of the wobj in the graphics.
            myWobj.ShowName = true;

            // The wobj is not held by the robot.
            myWobj.RobotHold = false;

            // Add the wobj to the DataDeclarations of the ActiveTask.
            station.ActiveTask.DataDeclarations.Add(myWobj);

            // Set the wobj as the active workobject of the ActiveTask.
            station.ActiveTask.ActiveWorkObject = (RsWorkObject)station.ActiveTask.FindDataDeclarationFromModuleScope(myWobj.Name, myWobj.ModuleName);
        }
        catch
        {
            Project.UndoContext.CancelUndoStep(CancelUndoStepType.Rollback);
            throw;
        }
        finally
        {
            Project.UndoContext.EndUndoStep();
        }</code></pre>

Properties

View Source

FrameSize

Gets or set the size of the user and object frames in the graphics.

Declaration
public double FrameSize { get; set; }
Property Value
Type Description
double
Examples

Get/Set FrameSize.

Project.UndoContext.BeginUndoStep("RsWorkObjectExample");
try
{
Station station = Station.ActiveStation;
            // Create a RsWorkObject.
            RsWorkObject myWobj = new RsWorkObject();

            // Get a valid RAPID name for the workobject and assign it.
            myWobj.Name = station.ActiveTask.GetValidRapidName("myWobj", "_", 1);

            // Set the frame size to twice the default size.
            myWobj.FrameSize = myWobj.FrameSize * 2;

            // Set the userframe to be a fixed coordinate system.
            myWobj.UserFrameProgrammed = true;

            // Translate the user frame.
            myWobj.UserFrame.X = 0.5;
            myWobj.UserFrame.Y = 0.2;
            myWobj.UserFrame.Z = 0.2;

            // Translate the object frame.
            myWobj.ObjectFrame.X = 0.5;
            myWobj.ObjectFrame.Y = 0.5;
            myWobj.ObjectFrame.Z = 0.5;

            // Rotate the object frame (pi radians around each axis).
            myWobj.ObjectFrame.RX = System.Math.PI;
            myWobj.ObjectFrame.RY = System.Math.PI;
            myWobj.ObjectFrame.RZ = System.Math.PI;

            // Display the wobj in the graphics.
            myWobj.Visible = true;

            // Display the name of the wobj in the graphics.
            myWobj.ShowName = true;

            // The wobj is not held by the robot.
            myWobj.RobotHold = false;

            // Add the wobj to the DataDeclarations of the ActiveTask.
            station.ActiveTask.DataDeclarations.Add(myWobj);

            // Set the wobj as the active workobject of the ActiveTask.
            station.ActiveTask.ActiveWorkObject = (RsWorkObject)station.ActiveTask.FindDataDeclarationFromModuleScope(myWobj.Name, myWobj.ModuleName);
        }
        catch
        {
            Project.UndoContext.CancelUndoStep(CancelUndoStepType.Rollback);
            throw;
        }
        finally
        {
            Project.UndoContext.EndUndoStep();
        }</code></pre>
View Source

Name

Gets or sets the name of the object

Declaration
public override string Name { get; set; }
Property Value
Type Description
string
Overrides
RsDataDeclaration.Name
View Source

ObjectFrame

Gets a Transform that corresponds to the object frame of the work object.

Declaration
public Transform ObjectFrame { get; }
Property Value
Type Description
Transform
Examples

Get ObjectFrame.

Project.UndoContext.BeginUndoStep("RsWorkObjectExample");
try
{
Station station = Station.ActiveStation;
            // Create a RsWorkObject.
            RsWorkObject myWobj = new RsWorkObject();

            // Get a valid RAPID name for the workobject and assign it.
            myWobj.Name = station.ActiveTask.GetValidRapidName("myWobj", "_", 1);

            // Set the frame size to twice the default size.
            myWobj.FrameSize = myWobj.FrameSize * 2;

            // Set the userframe to be a fixed coordinate system.
            myWobj.UserFrameProgrammed = true;

            // Translate the user frame.
            myWobj.UserFrame.X = 0.5;
            myWobj.UserFrame.Y = 0.2;
            myWobj.UserFrame.Z = 0.2;

            // Translate the object frame.
            myWobj.ObjectFrame.X = 0.5;
            myWobj.ObjectFrame.Y = 0.5;
            myWobj.ObjectFrame.Z = 0.5;

            // Rotate the object frame (pi radians around each axis).
            myWobj.ObjectFrame.RX = System.Math.PI;
            myWobj.ObjectFrame.RY = System.Math.PI;
            myWobj.ObjectFrame.RZ = System.Math.PI;

            // Display the wobj in the graphics.
            myWobj.Visible = true;

            // Display the name of the wobj in the graphics.
            myWobj.ShowName = true;

            // The wobj is not held by the robot.
            myWobj.RobotHold = false;

            // Add the wobj to the DataDeclarations of the ActiveTask.
            station.ActiveTask.DataDeclarations.Add(myWobj);

            // Set the wobj as the active workobject of the ActiveTask.
            station.ActiveTask.ActiveWorkObject = (RsWorkObject)station.ActiveTask.FindDataDeclarationFromModuleScope(myWobj.Name, myWobj.ModuleName);
        }
        catch
        {
            Project.UndoContext.CancelUndoStep(CancelUndoStepType.Rollback);
            throw;
        }
        finally
        {
            Project.UndoContext.EndUndoStep();
        }</code></pre>
View Source

RobotHold

Gets or sets a values specifying whether or not the robot is holding the work object: True if the robot is holding the workobject, false otherwise.

Declaration
public bool RobotHold { get; set; }
Property Value
Type Description
bool
Examples

Get/Set RobotHold.

Project.UndoContext.BeginUndoStep("RsWorkObjectExample");
try
{
Station station = Station.ActiveStation;
             // Create a RsWorkObject.
             RsWorkObject myWobj = new RsWorkObject();

             // Get a valid RAPID name for the workobject and assign it.
             myWobj.Name = station.ActiveTask.GetValidRapidName("myWobj", "_", 1);

             // Set the frame size to twice the default size.
             myWobj.FrameSize = myWobj.FrameSize * 2;

             // Set the userframe to be a fixed coordinate system.
             myWobj.UserFrameProgrammed = true;

             // Translate the user frame.
             myWobj.UserFrame.X = 0.5;
             myWobj.UserFrame.Y = 0.2;
             myWobj.UserFrame.Z = 0.2;

             // Translate the object frame.
             myWobj.ObjectFrame.X = 0.5;
             myWobj.ObjectFrame.Y = 0.5;
             myWobj.ObjectFrame.Z = 0.5;

             // Rotate the object frame (pi radians around each axis).
             myWobj.ObjectFrame.RX = System.Math.PI;
             myWobj.ObjectFrame.RY = System.Math.PI;
             myWobj.ObjectFrame.RZ = System.Math.PI;

             // Display the wobj in the graphics.
             myWobj.Visible = true;

             // Display the name of the wobj in the graphics.
             myWobj.ShowName = true;

             // The wobj is not held by the robot.
             myWobj.RobotHold = false;

             // Add the wobj to the DataDeclarations of the ActiveTask.
             station.ActiveTask.DataDeclarations.Add(myWobj);

             // Set the wobj as the active workobject of the ActiveTask.
             station.ActiveTask.ActiveWorkObject = (RsWorkObject)station.ActiveTask.FindDataDeclarationFromModuleScope(myWobj.Name, myWobj.ModuleName);
         }
         catch
         {
             Project.UndoContext.CancelUndoStep(CancelUndoStepType.Rollback);
             throw;
         }
         finally
         {
             Project.UndoContext.EndUndoStep();
         }</code></pre>
View Source

ShowName

Gets or sets whether the name of the workobject will be displayed in the graphics

Declaration
public bool ShowName { get; set; }
Property Value
Type Description
bool
Examples

Get/Set ShowName.

Project.UndoContext.BeginUndoStep("RsWorkObjectExample");
try
{
Station station = Station.ActiveStation;
            // Create a RsWorkObject.
            RsWorkObject myWobj = new RsWorkObject();

            // Get a valid RAPID name for the workobject and assign it.
            myWobj.Name = station.ActiveTask.GetValidRapidName("myWobj", "_", 1);

            // Set the frame size to twice the default size.
            myWobj.FrameSize = myWobj.FrameSize * 2;

            // Set the userframe to be a fixed coordinate system.
            myWobj.UserFrameProgrammed = true;

            // Translate the user frame.
            myWobj.UserFrame.X = 0.5;
            myWobj.UserFrame.Y = 0.2;
            myWobj.UserFrame.Z = 0.2;

            // Translate the object frame.
            myWobj.ObjectFrame.X = 0.5;
            myWobj.ObjectFrame.Y = 0.5;
            myWobj.ObjectFrame.Z = 0.5;

            // Rotate the object frame (pi radians around each axis).
            myWobj.ObjectFrame.RX = System.Math.PI;
            myWobj.ObjectFrame.RY = System.Math.PI;
            myWobj.ObjectFrame.RZ = System.Math.PI;

            // Display the wobj in the graphics.
            myWobj.Visible = true;

            // Display the name of the wobj in the graphics.
            myWobj.ShowName = true;

            // The wobj is not held by the robot.
            myWobj.RobotHold = false;

            // Add the wobj to the DataDeclarations of the ActiveTask.
            station.ActiveTask.DataDeclarations.Add(myWobj);

            // Set the wobj as the active workobject of the ActiveTask.
            station.ActiveTask.ActiveWorkObject = (RsWorkObject)station.ActiveTask.FindDataDeclarationFromModuleScope(myWobj.Name, myWobj.ModuleName);
        }
        catch
        {
            Project.UndoContext.CancelUndoStep(CancelUndoStepType.Rollback);
            throw;
        }
        finally
        {
            Project.UndoContext.EndUndoStep();
        }</code></pre>
View Source

UserFrame

Gets a Transform that corresponds to the user frame of the work object.

Declaration
public Transform UserFrame { get; }
Property Value
Type Description
Transform
Examples

Get UserFrame.

Project.UndoContext.BeginUndoStep("RsWorkObjectExample");
try
{
Station station = Station.ActiveStation;
            // Create a RsWorkObject.
            RsWorkObject myWobj = new RsWorkObject();

            // Get a valid RAPID name for the workobject and assign it.
            myWobj.Name = station.ActiveTask.GetValidRapidName("myWobj", "_", 1);

            // Set the frame size to twice the default size.
            myWobj.FrameSize = myWobj.FrameSize * 2;

            // Set the userframe to be a fixed coordinate system.
            myWobj.UserFrameProgrammed = true;

            // Translate the user frame.
            myWobj.UserFrame.X = 0.5;
            myWobj.UserFrame.Y = 0.2;
            myWobj.UserFrame.Z = 0.2;

            // Translate the object frame.
            myWobj.ObjectFrame.X = 0.5;
            myWobj.ObjectFrame.Y = 0.5;
            myWobj.ObjectFrame.Z = 0.5;

            // Rotate the object frame (pi radians around each axis).
            myWobj.ObjectFrame.RX = System.Math.PI;
            myWobj.ObjectFrame.RY = System.Math.PI;
            myWobj.ObjectFrame.RZ = System.Math.PI;

            // Display the wobj in the graphics.
            myWobj.Visible = true;

            // Display the name of the wobj in the graphics.
            myWobj.ShowName = true;

            // The wobj is not held by the robot.
            myWobj.RobotHold = false;

            // Add the wobj to the DataDeclarations of the ActiveTask.
            station.ActiveTask.DataDeclarations.Add(myWobj);

            // Set the wobj as the active workobject of the ActiveTask.
            station.ActiveTask.ActiveWorkObject = (RsWorkObject)station.ActiveTask.FindDataDeclarationFromModuleScope(myWobj.Name, myWobj.ModuleName);
        }
        catch
        {
            Project.UndoContext.CancelUndoStep(CancelUndoStepType.Rollback);
            throw;
        }
        finally
        {
            Project.UndoContext.EndUndoStep();
        }</code></pre>
View Source

UserFrameMechanicalUnit

Gets or sets the name of the mechanical unit with which the robot movements are coordinated. Only specified in the case of movable user coordinate systems (UserFrameProgrammed is False).

Declaration
public string UserFrameMechanicalUnit { get; set; }
Property Value
Type Description
string
Examples

Get/Set UserFrameMechanicalUnit.

Project.UndoContext.BeginUndoStep("RsWorkObjectExample");
try
{
Station station = Station.ActiveStation;
             // Create a RsWorkObject.
             RsWorkObject myWobj = new RsWorkObject();

             // Get a valid RAPID name for the workobject and assign it.
             myWobj.Name = station.ActiveTask.GetValidRapidName("myWobj", "_", 1);

             // Set the frame size to twice the default size.
             myWobj.FrameSize = myWobj.FrameSize * 2;

             // Set the userframe to be a fixed coordinate system.
             myWobj.UserFrameProgrammed = true;

             // Translate the user frame.
             myWobj.UserFrame.X = 0.5;
             myWobj.UserFrame.Y = 0.2;
             myWobj.UserFrame.Z = 0.2;

             // Translate the object frame.
             myWobj.ObjectFrame.X = 0.5;
             myWobj.ObjectFrame.Y = 0.5;
             myWobj.ObjectFrame.Z = 0.5;

             // Rotate the object frame (pi radians around each axis).
             myWobj.ObjectFrame.RX = System.Math.PI;
             myWobj.ObjectFrame.RY = System.Math.PI;
             myWobj.ObjectFrame.RZ = System.Math.PI;

             // Display the wobj in the graphics.
             myWobj.Visible = true;

             // Display the name of the wobj in the graphics.
             myWobj.ShowName = true;

             // The wobj is not held by the robot.
             myWobj.RobotHold = false;

             // Add the wobj to the DataDeclarations of the ActiveTask.
             station.ActiveTask.DataDeclarations.Add(myWobj);

             // Set the wobj as the active workobject of the ActiveTask.
             station.ActiveTask.ActiveWorkObject = (RsWorkObject)station.ActiveTask.FindDataDeclarationFromModuleScope(myWobj.Name, myWobj.ModuleName);
         }
         catch
         {
             Project.UndoContext.CancelUndoStep(CancelUndoStepType.Rollback);
             throw;
         }
         finally
         {
             Project.UndoContext.EndUndoStep();
         }</code></pre>
View Source

UserFrameProgrammed

Gets or sets a value that specifies whether or not the UserFrame is a fixed coordinate system or that it is moveable, i.e. by a coordinated external axis. True means that the UserFrame is fixed and False that its is moveable.

Declaration
public bool UserFrameProgrammed { get; set; }
Property Value
Type Description
bool
Examples

Get/Set UserFrameProgrammed.

Project.UndoContext.BeginUndoStep("RsWorkObjectExample");
try
{
Station station = Station.ActiveStation;
            // Create a RsWorkObject.
            RsWorkObject myWobj = new RsWorkObject();

            // Get a valid RAPID name for the workobject and assign it.
            myWobj.Name = station.ActiveTask.GetValidRapidName("myWobj", "_", 1);

            // Set the frame size to twice the default size.
            myWobj.FrameSize = myWobj.FrameSize * 2;

            // Set the userframe to be a fixed coordinate system.
            myWobj.UserFrameProgrammed = true;

            // Translate the user frame.
            myWobj.UserFrame.X = 0.5;
            myWobj.UserFrame.Y = 0.2;
            myWobj.UserFrame.Z = 0.2;

            // Translate the object frame.
            myWobj.ObjectFrame.X = 0.5;
            myWobj.ObjectFrame.Y = 0.5;
            myWobj.ObjectFrame.Z = 0.5;

            // Rotate the object frame (pi radians around each axis).
            myWobj.ObjectFrame.RX = System.Math.PI;
            myWobj.ObjectFrame.RY = System.Math.PI;
            myWobj.ObjectFrame.RZ = System.Math.PI;

            // Display the wobj in the graphics.
            myWobj.Visible = true;

            // Display the name of the wobj in the graphics.
            myWobj.ShowName = true;

            // The wobj is not held by the robot.
            myWobj.RobotHold = false;

            // Add the wobj to the DataDeclarations of the ActiveTask.
            station.ActiveTask.DataDeclarations.Add(myWobj);

            // Set the wobj as the active workobject of the ActiveTask.
            station.ActiveTask.ActiveWorkObject = (RsWorkObject)station.ActiveTask.FindDataDeclarationFromModuleScope(myWobj.Name, myWobj.ModuleName);
        }
        catch
        {
            Project.UndoContext.CancelUndoStep(CancelUndoStepType.Rollback);
            throw;
        }
        finally
        {
            Project.UndoContext.EndUndoStep();
        }</code></pre>
View Source

Visible

Gets or sets whether the user and object frames should be displayed in the graphics.

Declaration
public bool Visible { get; set; }
Property Value
Type Description
bool
Examples

Get/Set Visible.

Project.UndoContext.BeginUndoStep("RsWorkObjectExample");
try
{
Station station = Station.ActiveStation;
            // Create a RsWorkObject.
            RsWorkObject myWobj = new RsWorkObject();

            // Get a valid RAPID name for the workobject and assign it.
            myWobj.Name = station.ActiveTask.GetValidRapidName("myWobj", "_", 1);

            // Set the frame size to twice the default size.
            myWobj.FrameSize = myWobj.FrameSize * 2;

            // Set the userframe to be a fixed coordinate system.
            myWobj.UserFrameProgrammed = true;

            // Translate the user frame.
            myWobj.UserFrame.X = 0.5;
            myWobj.UserFrame.Y = 0.2;
            myWobj.UserFrame.Z = 0.2;

            // Translate the object frame.
            myWobj.ObjectFrame.X = 0.5;
            myWobj.ObjectFrame.Y = 0.5;
            myWobj.ObjectFrame.Z = 0.5;

            // Rotate the object frame (pi radians around each axis).
            myWobj.ObjectFrame.RX = System.Math.PI;
            myWobj.ObjectFrame.RY = System.Math.PI;
            myWobj.ObjectFrame.RZ = System.Math.PI;

            // Display the wobj in the graphics.
            myWobj.Visible = true;

            // Display the name of the wobj in the graphics.
            myWobj.ShowName = true;

            // The wobj is not held by the robot.
            myWobj.RobotHold = false;

            // Add the wobj to the DataDeclarations of the ActiveTask.
            station.ActiveTask.DataDeclarations.Add(myWobj);

            // Set the wobj as the active workobject of the ActiveTask.
            station.ActiveTask.ActiveWorkObject = (RsWorkObject)station.ActiveTask.FindDataDeclarationFromModuleScope(myWobj.Name, myWobj.ModuleName);
        }
        catch
        {
            Project.UndoContext.CancelUndoStep(CancelUndoStepType.Rollback);
            throw;
        }
        finally
        {
            Project.UndoContext.EndUndoStep();
        }</code></pre>

Methods

View Source

AfterLoad(PimDocument)

Declaration
protected override void AfterLoad(PimDocument doc)
Parameters
Type Name Description
PimDocument doc
Overrides
ProjectObject.AfterLoad(PimDocument)
View Source

Copy()

Creates a copy of the DataDeclaration.

Declaration
public override ProjectObject Copy()
Returns
Type Description
ProjectObject
Overrides
RsDataDeclaration.Copy()

Implements

ISupportCopy
IAttachableChild
  • View Source
In this article
Back to top Copyright © 2025 ABB