Click or drag to resize
RsTargetApproachVector Property
Gets or sets an AxisDirection that represents an approach vector for this target.

Namespace:  ABB.Robotics.RobotStudio.Stations
Assembly:  ABB.Robotics.RobotStudio.Stations (in ABB.Robotics.RobotStudio.Stations.dll) Version: 7.0.8747.636
Syntax
C#
public AxisDirection ApproachVector { get; set; }

Property Value

Type: AxisDirection
Examples
Get ApproachVector.
Target Properties Example
Project.UndoContext.BeginUndoStep("Target Properties");
try
{
    // Instance active station.
    Station stn = Station.ActiveStation;

    // Get the active workobject.
    RsWorkObject wobj = stn.ActiveTask.ActiveWorkObject;

    // Create a new RsRobTarget and add it to ActiveTask.
    RsRobTarget robTarget = new RsRobTarget();
    robTarget.Name = stn.ActiveTask.GetValidRapidName("MyRobTarget", "_", 10);
    stn.ActiveTask.DataDeclarations.Add(robTarget);

    // Create an RsTarget from wobj and RobTarget.
    RsTarget target = new RsTarget(wobj, robTarget);

    // Add RsTarget to ActiveTask.
    stn.ActiveTask.Targets.Add(target);

    // Set the name of the target.
    target.Name = robTarget.Name;

    // Add a custom attribute to the target.
    target.Attributes.Add("MyAttribute", "10");

    // Output the project that the target is part of, and the parent of the target.
    Logger.AddMessage(new LogMessage("The target: " + target.Name + " is part of the project: " +
            target.ContainingProject.Name + ". The targets parent is: " + target.Parent.Name));

    // Output the ToString-reprentation of the target and its types diplay name.
    Logger.AddMessage(new LogMessage("The targets ToString representation is '" +
            target.ToString() + "' and its TypeDisplayName is '" + target.TypeDisplayName + "'."));

    // Set the workobject of the target as the active workobject.
    stn.ActiveTask.ActiveWorkObject = target.WorkObject;

    // Create a copy of the RobTarget.
    RsRobTarget newRobTarget = (RsRobTarget)robTarget.Copy();

    // Assign the copy to the target.
    target.RobTarget = newRobTarget;

    // Check if the target is invisible, and make it visible and yellow.
    if (!target.Visible)
    {
        target.Visible = true;
        Color col = Color.Yellow;
        target.Color = col;
    }

    // Make the target's grapical display size twice as large.
    target.FrameSize = target.FrameSize * 2;

    // Get the transform and output its values using the logger.
    Logger.AddMessage(new LogMessage("Transform of target: " + target.Name
                                    + "; X: " + target.Transform.X
                                    + "; Y: " + target.Transform.Y
                                    + "; Z: " + target.Transform.Z
                                    + "; Rx: " + target.Transform.RX
                                    + "; Ry: " + target.Transform.RY
                                    + "; Rz: " + target.Transform.RZ
                                    ));

    // Get the ReferenceFrame of the target.
    Transform refFrame = target.ReferenceFrame;

    // Show the reference frame in the graphics.
    target.ShowReferenceFrame = true;

    // If the AxisDirection of the target is undefined then set it to negative x.
    if (target.ApproachVector == AxisDirection.Undefined)
    {
        target.ApproachVector = AxisDirection.NegativeX;
    }
}
catch
{
    Project.UndoContext.CancelUndoStep(CancelUndoStepType.Rollback);
    throw;
}
finally
{
    Project.UndoContext.EndUndoStep();
}
Version Information

Supported in: 1.0.0.0
See Also