Class RsInstructionArgument
Represents an argument of a RsInstruction or a RsInstructionTemplate.
Inherited Members
Namespace: ABB.Robotics.RobotStudio.Stations
Assembly: ABB.Robotics.RobotStudio.Stations.dll
Syntax
sistent("RoutineArgument")]
public sealed class RsInstructionArgument : ProjectObject
Constructors
RsInstructionArgument(String, String)
Creates and initializes a new RsInstructionArgument object.
Declaration
public RsInstructionArgument(string name, string value)
Parameters
Type | Name | Description |
---|---|---|
String | name | The name of the RsInstructionArgument to create. |
String | value | The value of the RsInstructionArgument to create. |
Examples
Create RsInstructionArgument.
Project.UndoContext.BeginUndoStep("RsInstructionArgumentExample");
try
{
Station station = Station.ActiveStation;
// Create a RsPathProcedure and add it to the ActiveTask.
RsPathProcedure myPath = new RsPathProcedure("myPath");
station.ActiveTask.PathProcedures.Add(myPath);
// Create a new RobTarget and add it to the ActiveTask.
RsRobTarget myRobTarget = new RsRobTarget();
myRobTarget.Name = station.ActiveTask.GetValidRapidName("myRobTarget", "_", 1);
station.ActiveTask.DataDeclarations.Add(myRobTarget);
// Create a linear move instruction using the move definition and the default template.
RsMoveInstruction myMoveL = new RsMoveInstruction(station.ActiveTask, "Move", "Default", MotionType.Linear, "wobj0", myRobTarget.Name, "tool0");
myPath.Instructions.Add(myMoveL);
// Output some information regarding the MoveInstruction to the logger.
Logger.AddMessage(new LogMessage("The MoveInstruction'" + myMoveL.Name + "' has the following InstructionArguments"));
foreach (RsInstructionArgument instrArg in myMoveL.InstructionArguments)
{
Logger.AddMessage(new LogMessage("The InstructionArgument '" + instrArg.Name +
"' has value = '" + instrArg.Value +
"' and is enabled:'" + instrArg.Enabled.ToString() + "'"));
}
if (myMoveL.InstructionArguments.Contains("ToPoint"))
{
Logger.AddMessage(new LogMessage("The collection contains the ToPoint argument!"));
}
else
{
Logger.AddMessage(new LogMessage("The collection does not contain the ToPoint argument!"));
}
RsInstructionArgument myInstrArg;
if (myMoveL.InstructionArguments.TryGetInstructionArgument("ToPoint", out myInstrArg))
{
Logger.AddMessage(new LogMessage("The value of the ToPoint argument is: '" + myInstrArg.Value + "'"));
}
else
{
Logger.AddMessage(new LogMessage("Could not get the ToPoint argument!"));
}
}
catch
{
Project.UndoContext.CancelUndoStep(CancelUndoStepType.Rollback);
throw;
}
finally
{
Project.UndoContext.EndUndoStep();
}
Properties
Enabled
Gets or sets the Enabled. Set Enabled to false to not use the instruction argument.
Declaration
public bool Enabled { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
Remarks
Only relevant for optional arguments. Enabled is always true for non-optional arguments.
Examples
Get/Set Enabled.
Project.UndoContext.BeginUndoStep("RsInstructionArgumentExample");
try
{
Station station = Station.ActiveStation;
// Create a RsPathProcedure and add it to the ActiveTask.
RsPathProcedure myPath = new RsPathProcedure("myPath");
station.ActiveTask.PathProcedures.Add(myPath);
// Create a new RobTarget and add it to the ActiveTask.
RsRobTarget myRobTarget = new RsRobTarget();
myRobTarget.Name = station.ActiveTask.GetValidRapidName("myRobTarget", "_", 1);
station.ActiveTask.DataDeclarations.Add(myRobTarget);
// Create a linear move instruction using the move definition and the default template.
RsMoveInstruction myMoveL = new RsMoveInstruction(station.ActiveTask, "Move", "Default", MotionType.Linear, "wobj0", myRobTarget.Name, "tool0");
myPath.Instructions.Add(myMoveL);
// Output some information regarding the MoveInstruction to the logger.
Logger.AddMessage(new LogMessage("The MoveInstruction'" + myMoveL.Name + "' has the following InstructionArguments"));
foreach (RsInstructionArgument instrArg in myMoveL.InstructionArguments)
{
Logger.AddMessage(new LogMessage("The InstructionArgument '" + instrArg.Name +
"' has value = '" + instrArg.Value +
"' and is enabled:'" + instrArg.Enabled.ToString() + "'"));
}
if (myMoveL.InstructionArguments.Contains("ToPoint"))
{
Logger.AddMessage(new LogMessage("The collection contains the ToPoint argument!"));
}
else
{
Logger.AddMessage(new LogMessage("The collection does not contain the ToPoint argument!"));
}
RsInstructionArgument myInstrArg;
if (myMoveL.InstructionArguments.TryGetInstructionArgument("ToPoint", out myInstrArg))
{
Logger.AddMessage(new LogMessage("The value of the ToPoint argument is: '" + myInstrArg.Value + "'"));
}
else
{
Logger.AddMessage(new LogMessage("Could not get the ToPoint argument!"));
}
}
catch
{
Project.UndoContext.CancelUndoStep(CancelUndoStepType.Rollback);
throw;
}
finally
{
Project.UndoContext.EndUndoStep();
}
Parent
Get the parent of the instruction argument
Declaration
public override ProjectObject Parent { get; }
Property Value
Type | Description |
---|---|
ProjectObject |
Overrides
Examples
Get Parent.
Project.UndoContext.BeginUndoStep("RsInstructionArgumentExample");
try
{
Station station = Station.ActiveStation;
// Create a RsPathProcedure and add it to the ActiveTask.
RsPathProcedure myPath = new RsPathProcedure("myPath");
station.ActiveTask.PathProcedures.Add(myPath);
// Create a new RobTarget and add it to the ActiveTask.
RsRobTarget myRobTarget = new RsRobTarget();
myRobTarget.Name = station.ActiveTask.GetValidRapidName("myRobTarget", "_", 1);
station.ActiveTask.DataDeclarations.Add(myRobTarget);
// Create a linear move instruction using the move definition and the default template.
RsMoveInstruction myMoveL = new RsMoveInstruction(station.ActiveTask, "Move", "Default", MotionType.Linear, "wobj0", myRobTarget.Name, "tool0");
myPath.Instructions.Add(myMoveL);
// Output some information regarding the MoveInstruction to the logger.
Logger.AddMessage(new LogMessage("The MoveInstruction'" + myMoveL.Name + "' has the following InstructionArguments"));
foreach (RsInstructionArgument instrArg in myMoveL.InstructionArguments)
{
Logger.AddMessage(new LogMessage("The InstructionArgument '" + instrArg.Name +
"' has value = '" + instrArg.Value +
"' and is enabled:'" + instrArg.Enabled.ToString() + "'"));
}
if (myMoveL.InstructionArguments.Contains("ToPoint"))
{
Logger.AddMessage(new LogMessage("The collection contains the ToPoint argument!"));
}
else
{
Logger.AddMessage(new LogMessage("The collection does not contain the ToPoint argument!"));
}
RsInstructionArgument myInstrArg;
if (myMoveL.InstructionArguments.TryGetInstructionArgument("ToPoint", out myInstrArg))
{
Logger.AddMessage(new LogMessage("The value of the ToPoint argument is: '" + myInstrArg.Value + "'"));
}
else
{
Logger.AddMessage(new LogMessage("Could not get the ToPoint argument!"));
}
}
catch
{
Project.UndoContext.CancelUndoStep(CancelUndoStepType.Rollback);
throw;
}
finally
{
Project.UndoContext.EndUndoStep();
}
Value
Get or sets the value of the instruction argument
Declaration
public string Value { get; set; }
Property Value
Type | Description |
---|---|
String |
Remarks
For optional arguments, Enabled must also be true for the argument to be used.
Examples
Get/Set Value.
Project.UndoContext.BeginUndoStep("RsInstructionArgumentExample");
try
{
Station station = Station.ActiveStation;
// Create a RsPathProcedure and add it to the ActiveTask.
RsPathProcedure myPath = new RsPathProcedure("myPath");
station.ActiveTask.PathProcedures.Add(myPath);
// Create a new RobTarget and add it to the ActiveTask.
RsRobTarget myRobTarget = new RsRobTarget();
myRobTarget.Name = station.ActiveTask.GetValidRapidName("myRobTarget", "_", 1);
station.ActiveTask.DataDeclarations.Add(myRobTarget);
// Create a linear move instruction using the move definition and the default template.
RsMoveInstruction myMoveL = new RsMoveInstruction(station.ActiveTask, "Move", "Default", MotionType.Linear, "wobj0", myRobTarget.Name, "tool0");
myPath.Instructions.Add(myMoveL);
// Output some information regarding the MoveInstruction to the logger.
Logger.AddMessage(new LogMessage("The MoveInstruction'" + myMoveL.Name + "' has the following InstructionArguments"));
foreach (RsInstructionArgument instrArg in myMoveL.InstructionArguments)
{
Logger.AddMessage(new LogMessage("The InstructionArgument '" + instrArg.Name +
"' has value = '" + instrArg.Value +
"' and is enabled:'" + instrArg.Enabled.ToString() + "'"));
}
if (myMoveL.InstructionArguments.Contains("ToPoint"))
{
Logger.AddMessage(new LogMessage("The collection contains the ToPoint argument!"));
}
else
{
Logger.AddMessage(new LogMessage("The collection does not contain the ToPoint argument!"));
}
RsInstructionArgument myInstrArg;
if (myMoveL.InstructionArguments.TryGetInstructionArgument("ToPoint", out myInstrArg))
{
Logger.AddMessage(new LogMessage("The value of the ToPoint argument is: '" + myInstrArg.Value + "'"));
}
else
{
Logger.AddMessage(new LogMessage("Could not get the ToPoint argument!"));
}
}
catch
{
Project.UndoContext.CancelUndoStep(CancelUndoStepType.Rollback);
throw;
}
finally
{
Project.UndoContext.EndUndoStep();
}
Methods
OnUndoRedo()
Declaration
protected override void OnUndoRedo()