Class RsInstructionArgumentCollection
Inheritance
RsInstructionArgumentCollection
Assembly: ABB.Robotics.RobotStudio.Stations.dll
Syntax
public class RsInstructionArgumentCollection : ICollection, IEnumerable<RsInstructionArgument>, IEnumerable
Examples
InstructionArguments Collection.
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
Count
Declaration
public virtual int Count { get; }
Property Value
IsSynchronized
Declaration
public virtual bool IsSynchronized { get; }
Property Value
Item[Int32]
Declaration
public RsInstructionArgument this[int index] { get; }
Parameters
Type |
Name |
Description |
Int32 |
index |
|
Property Value
Item[String]
Gets the named item in the collection
Declaration
public RsInstructionArgument this[string name] { get; }
Parameters
Type |
Name |
Description |
String |
name |
|
Property Value
Examples
Get Item.
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
Declaration
public ProjectObject Parent { get; }
Property Value
SyncRoot
Declaration
public virtual object SyncRoot { get; }
Property Value
Methods
Add(RsInstructionArgument)
Add a RsInstructionArgument to the collection.
Declaration
public void Add(RsInstructionArgument instructionArgument)
Parameters
Contains(RsInstructionArgument)
Declaration
public bool Contains(RsInstructionArgument obj)
Parameters
Returns
Contains(String)
Check to see if a named item is part of the collection.
Declaration
public bool Contains(string name)
Parameters
Type |
Name |
Description |
String |
name |
The name to look for.
|
Returns
Type |
Description |
Boolean |
True if the named item is part of the collection, false otherwise.
|
Examples
Contains.
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();
}
CopyTo(RsInstructionArgument[], Int32)
Declaration
public void CopyTo(RsInstructionArgument[] array, int index)
Parameters
CopyTo(Array, Int32)
Declaration
public virtual void CopyTo(Array array, int index)
Parameters
GetEnumerator()
Declaration
public virtual IEnumerator GetEnumerator()
Returns
Remove(RsInstructionArgument)
Removes a RsInstructionArgument from the collection.
Declaration
public void Remove(RsInstructionArgument instructionArgument)
Parameters
ToArray()
Declaration
public RsInstructionArgument[] ToArray()
Returns
TryGetInstructionArgument(String, out RsInstructionArgument)
Gets the argument with the specified name.
Declaration
public bool TryGetInstructionArgument(string name, out RsInstructionArgument instructionArgument)
Parameters
Type |
Name |
Description |
String |
name |
The name of the argument to get.
|
RsInstructionArgument |
instructionArgument |
When this method returns, contains the argument associated with the specified name,
if the name is found; otherwise, null.
|
Returns
Type |
Description |
Boolean |
true if the RsInstructionArgumentCollection contains an element with the specified name; otherwise, false.
|
Examples
TryGetInstructionArgument.
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();
}
Exceptions