Class RsInstructionCollection
Inheritance
RsInstructionCollection
Assembly: ABB.Robotics.RobotStudio.Stations.dll
Syntax
public class RsInstructionCollection : IList<RsInstruction>, ICollection<RsInstruction>, IEnumerable<RsInstruction>, ICollection, IEnumerable
Examples
InstructionCollection.
Project.UndoContext.BeginUndoStep("RsMoveInstructionCreate");
try
{
#region RsMoveInstructionCreateStep1
Station station = Station.ActiveStation;
#endregion
// First import a robot (a mechanism) and add it to the station.
// NOTE: Uncomment the following lines and use them insted of the third line with the load command.
// GraphicComponentLibrary mechLib = GraphicComponentLibrary.Load(lib, true);
#region RsMoveInstructionCreateStep2
GraphicComponentLibrary mechLib = GraphicComponentLibrary.Load("IRB140_6_81_C_G_03.rslib", true);
Mechanism mechGfx = (Mechanism)mechLib.RootComponent.CopyInstance();
mechGfx.Name = "IRB140_6_81_C_G_03";
station.GraphicComponents.Add(mechGfx);
#endregion
// Set the active task to the mechanism task.
#region RsMoveInstructionCreateStep3
station.ActiveTask = mechGfx.Task;
#endregion
// Create a WorkObject and add it to the ActiveTask.
#region RsMoveInstructionCreateStep4
RsWorkObject myWobj = new RsWorkObject();
myWobj.Name = station.ActiveTask.GetValidRapidName("myWobj", "_", 1);
station.ActiveTask.DataDeclarations.Add(myWobj);
#endregion
// Create a ToolData and add it to the ActiveTask.
#region RsMoveInstructionCreateStep5
RsToolData myTool = new RsToolData();
myTool.Name = station.ActiveTask.GetValidRapidName("myTool", "_", 1);
station.ActiveTask.DataDeclarations.Add(myTool);
#endregion
// Create a new RobTarget and add it to the ActiveTask.
#region RsMoveInstructionCreateStep6
RsRobTarget toPoint = new RsRobTarget();
toPoint.Name = station.ActiveTask.GetValidRapidName("myRobTarget", "_", 1);
station.ActiveTask.DataDeclarations.Add(toPoint);
#endregion
// Create a graphic representation of the RobTarget and RsTarget.
#region RsMoveInstructionCreateStep7
RsTarget myRsTarget = new RsTarget(myWobj, toPoint);
myRsTarget.Name = toPoint.Name;
station.ActiveTask.Targets.Add(myRsTarget);
#endregion
// Create a PathProcedure.
#region RsMoveInstructionCreateStep8
RsPathProcedure myPath = new RsPathProcedure("myPath");
station.ActiveTask.PathProcedures.Add(myPath);
#endregion
// Create a linear move instruction using the move definition and the default template.
#region RsMoveInstructionCreateStep9
RsMoveInstruction myMoveL = new RsMoveInstruction
(station.ActiveTask, "Move", "Default",
MotionType.Linear, myWobj.Name, toPoint.Name, myTool.Name);
myPath.Instructions.Add(myMoveL);
#endregion
// Create a new RobTarget to use as cirPoint and add it to the ActiveTask.
#region RsMoveInstructionCreateStep10
RsRobTarget cirPoint = new RsRobTarget();
cirPoint.Name = station.ActiveTask.GetValidRapidName("myRobTarget", "_", 1);
cirPoint.Frame.X = cirPoint.Frame.X + 0.10;
cirPoint.Frame.Z = cirPoint.Frame.Z + 0.10;
station.ActiveTask.DataDeclarations.Add(cirPoint);
#endregion
// Create a graphic representation of the RobTarget and RsTarget.
#region RsMoveInstructionCreateStep11
RsTarget myRsTarget_2 = new RsTarget(myWobj, cirPoint);
myRsTarget_2.Name = cirPoint.Name;
station.ActiveTask.Targets.Add(myRsTarget_2);
#endregion
// Create a circular move instruction.
#region RsMoveInstructionCreateStep12
RsMoveInstruction myMoveCirc = new RsMoveInstruction(station.ActiveTask,
"Move", "Default", myWobj.Name, cirPoint.Name, toPoint.Name, myTool.Name);
myPath.Instructions.Add(myMoveCirc);
#endregion
// Create a joint target to be able to create a MoveAbsJ move instruction.
#region RsMoveInstructionCreateStep13
RsJointTarget myJointTarget = new RsJointTarget();
myJointTarget.Name = station.ActiveTask.GetValidRapidName("myJointTarget", "_", 1);
station.ActiveTask.DataDeclarations.Add(myJointTarget);
#endregion
// Set the robot axis values.
#region RsMoveInstructionCreateStep14
RobotAxisValues rbAxis = new RobotAxisValues();
rbAxis.Rax_1 = 70.0000000000001;
rbAxis.Rax_2 = -30;
rbAxis.Rax_3 = 30;
rbAxis.Rax_4 = -55.0000000000001;
rbAxis.Rax_5 = 40;
rbAxis.Rax_6 = 10;
myJointTarget.SetRobotAxes(rbAxis, false);
#endregion
// Create a MoveAbsJ move instruction (this only makes sense if there is a mechanism in the station).
#region RsMoveInstructionCreateStep15
RsMoveInstruction myMoveAbsJ =
new RsMoveInstruction(station.ActiveTask, "MoveAbs", "Default", myJointTarget.Name);
myPath.Instructions.Add(myMoveAbsJ);
#endregion
}
catch
{
Project.UndoContext.CancelUndoStep(CancelUndoStepType.Rollback);
throw;
}
finally
{
Project.UndoContext.EndUndoStep();
}
Properties
Count
Declaration
public virtual int Count { get; }
Property Value
IsReadOnly
Declaration
public bool IsReadOnly { get; }
Property Value
IsSynchronized
Declaration
public virtual bool IsSynchronized { get; }
Property Value
Item[Int32]
Declaration
public RsInstruction this[int index] { get; set; }
Parameters
Type |
Name |
Description |
Int32 |
index |
|
Property Value
Parent
Declaration
public ProjectObject Parent { get; }
Property Value
SyncRoot
Declaration
public virtual object SyncRoot { get; }
Property Value
Methods
Add(RsInstruction)
Add an instruction to a path procedure.
Declaration
public void Add(RsInstruction item)
Parameters
Type |
Name |
Description |
RsInstruction |
item |
The instruction to be added.
|
Examples
InstructionCollection.
Project.UndoContext.BeginUndoStep("RsMoveInstructionCreate");
try
{
#region RsMoveInstructionCreateStep1
Station station = Station.ActiveStation;
#endregion
// First import a robot (a mechanism) and add it to the station.
// NOTE: Uncomment the following lines and use them insted of the third line with the load command.
// GraphicComponentLibrary mechLib = GraphicComponentLibrary.Load(lib, true);
#region RsMoveInstructionCreateStep2
GraphicComponentLibrary mechLib = GraphicComponentLibrary.Load("IRB140_6_81_C_G_03.rslib", true);
Mechanism mechGfx = (Mechanism)mechLib.RootComponent.CopyInstance();
mechGfx.Name = "IRB140_6_81_C_G_03";
station.GraphicComponents.Add(mechGfx);
#endregion
// Set the active task to the mechanism task.
#region RsMoveInstructionCreateStep3
station.ActiveTask = mechGfx.Task;
#endregion
// Create a WorkObject and add it to the ActiveTask.
#region RsMoveInstructionCreateStep4
RsWorkObject myWobj = new RsWorkObject();
myWobj.Name = station.ActiveTask.GetValidRapidName("myWobj", "_", 1);
station.ActiveTask.DataDeclarations.Add(myWobj);
#endregion
// Create a ToolData and add it to the ActiveTask.
#region RsMoveInstructionCreateStep5
RsToolData myTool = new RsToolData();
myTool.Name = station.ActiveTask.GetValidRapidName("myTool", "_", 1);
station.ActiveTask.DataDeclarations.Add(myTool);
#endregion
// Create a new RobTarget and add it to the ActiveTask.
#region RsMoveInstructionCreateStep6
RsRobTarget toPoint = new RsRobTarget();
toPoint.Name = station.ActiveTask.GetValidRapidName("myRobTarget", "_", 1);
station.ActiveTask.DataDeclarations.Add(toPoint);
#endregion
// Create a graphic representation of the RobTarget and RsTarget.
#region RsMoveInstructionCreateStep7
RsTarget myRsTarget = new RsTarget(myWobj, toPoint);
myRsTarget.Name = toPoint.Name;
station.ActiveTask.Targets.Add(myRsTarget);
#endregion
// Create a PathProcedure.
#region RsMoveInstructionCreateStep8
RsPathProcedure myPath = new RsPathProcedure("myPath");
station.ActiveTask.PathProcedures.Add(myPath);
#endregion
// Create a linear move instruction using the move definition and the default template.
#region RsMoveInstructionCreateStep9
RsMoveInstruction myMoveL = new RsMoveInstruction
(station.ActiveTask, "Move", "Default",
MotionType.Linear, myWobj.Name, toPoint.Name, myTool.Name);
myPath.Instructions.Add(myMoveL);
#endregion
// Create a new RobTarget to use as cirPoint and add it to the ActiveTask.
#region RsMoveInstructionCreateStep10
RsRobTarget cirPoint = new RsRobTarget();
cirPoint.Name = station.ActiveTask.GetValidRapidName("myRobTarget", "_", 1);
cirPoint.Frame.X = cirPoint.Frame.X + 0.10;
cirPoint.Frame.Z = cirPoint.Frame.Z + 0.10;
station.ActiveTask.DataDeclarations.Add(cirPoint);
#endregion
// Create a graphic representation of the RobTarget and RsTarget.
#region RsMoveInstructionCreateStep11
RsTarget myRsTarget_2 = new RsTarget(myWobj, cirPoint);
myRsTarget_2.Name = cirPoint.Name;
station.ActiveTask.Targets.Add(myRsTarget_2);
#endregion
// Create a circular move instruction.
#region RsMoveInstructionCreateStep12
RsMoveInstruction myMoveCirc = new RsMoveInstruction(station.ActiveTask,
"Move", "Default", myWobj.Name, cirPoint.Name, toPoint.Name, myTool.Name);
myPath.Instructions.Add(myMoveCirc);
#endregion
// Create a joint target to be able to create a MoveAbsJ move instruction.
#region RsMoveInstructionCreateStep13
RsJointTarget myJointTarget = new RsJointTarget();
myJointTarget.Name = station.ActiveTask.GetValidRapidName("myJointTarget", "_", 1);
station.ActiveTask.DataDeclarations.Add(myJointTarget);
#endregion
// Set the robot axis values.
#region RsMoveInstructionCreateStep14
RobotAxisValues rbAxis = new RobotAxisValues();
rbAxis.Rax_1 = 70.0000000000001;
rbAxis.Rax_2 = -30;
rbAxis.Rax_3 = 30;
rbAxis.Rax_4 = -55.0000000000001;
rbAxis.Rax_5 = 40;
rbAxis.Rax_6 = 10;
myJointTarget.SetRobotAxes(rbAxis, false);
#endregion
// Create a MoveAbsJ move instruction (this only makes sense if there is a mechanism in the station).
#region RsMoveInstructionCreateStep15
RsMoveInstruction myMoveAbsJ =
new RsMoveInstruction(station.ActiveTask, "MoveAbs", "Default", myJointTarget.Name);
myPath.Instructions.Add(myMoveAbsJ);
#endregion
}
catch
{
Project.UndoContext.CancelUndoStep(CancelUndoStepType.Rollback);
throw;
}
finally
{
Project.UndoContext.EndUndoStep();
}
Exceptions
Add(RsInstruction, RsInstruction)
Add an instruction to a path procedure.
Declaration
public void Add(RsInstruction instruction, RsInstruction afterThisInstruction)
Parameters
Type |
Name |
Description |
RsInstruction |
instruction |
The instruction to be added.
|
RsInstruction |
afterThisInstruction |
The afterThisInstruction that instruction should be added after.
If this null, instruction is added before the first instruction.
|
Examples
InstructionCollection.
Project.UndoContext.BeginUndoStep("RsMoveInstructionCreate");
try
{
#region RsMoveInstructionCreateStep1
Station station = Station.ActiveStation;
#endregion
// First import a robot (a mechanism) and add it to the station.
// NOTE: Uncomment the following lines and use them insted of the third line with the load command.
// GraphicComponentLibrary mechLib = GraphicComponentLibrary.Load(lib, true);
#region RsMoveInstructionCreateStep2
GraphicComponentLibrary mechLib = GraphicComponentLibrary.Load("IRB140_6_81_C_G_03.rslib", true);
Mechanism mechGfx = (Mechanism)mechLib.RootComponent.CopyInstance();
mechGfx.Name = "IRB140_6_81_C_G_03";
station.GraphicComponents.Add(mechGfx);
#endregion
// Set the active task to the mechanism task.
#region RsMoveInstructionCreateStep3
station.ActiveTask = mechGfx.Task;
#endregion
// Create a WorkObject and add it to the ActiveTask.
#region RsMoveInstructionCreateStep4
RsWorkObject myWobj = new RsWorkObject();
myWobj.Name = station.ActiveTask.GetValidRapidName("myWobj", "_", 1);
station.ActiveTask.DataDeclarations.Add(myWobj);
#endregion
// Create a ToolData and add it to the ActiveTask.
#region RsMoveInstructionCreateStep5
RsToolData myTool = new RsToolData();
myTool.Name = station.ActiveTask.GetValidRapidName("myTool", "_", 1);
station.ActiveTask.DataDeclarations.Add(myTool);
#endregion
// Create a new RobTarget and add it to the ActiveTask.
#region RsMoveInstructionCreateStep6
RsRobTarget toPoint = new RsRobTarget();
toPoint.Name = station.ActiveTask.GetValidRapidName("myRobTarget", "_", 1);
station.ActiveTask.DataDeclarations.Add(toPoint);
#endregion
// Create a graphic representation of the RobTarget and RsTarget.
#region RsMoveInstructionCreateStep7
RsTarget myRsTarget = new RsTarget(myWobj, toPoint);
myRsTarget.Name = toPoint.Name;
station.ActiveTask.Targets.Add(myRsTarget);
#endregion
// Create a PathProcedure.
#region RsMoveInstructionCreateStep8
RsPathProcedure myPath = new RsPathProcedure("myPath");
station.ActiveTask.PathProcedures.Add(myPath);
#endregion
// Create a linear move instruction using the move definition and the default template.
#region RsMoveInstructionCreateStep9
RsMoveInstruction myMoveL = new RsMoveInstruction
(station.ActiveTask, "Move", "Default",
MotionType.Linear, myWobj.Name, toPoint.Name, myTool.Name);
myPath.Instructions.Add(myMoveL);
#endregion
// Create a new RobTarget to use as cirPoint and add it to the ActiveTask.
#region RsMoveInstructionCreateStep10
RsRobTarget cirPoint = new RsRobTarget();
cirPoint.Name = station.ActiveTask.GetValidRapidName("myRobTarget", "_", 1);
cirPoint.Frame.X = cirPoint.Frame.X + 0.10;
cirPoint.Frame.Z = cirPoint.Frame.Z + 0.10;
station.ActiveTask.DataDeclarations.Add(cirPoint);
#endregion
// Create a graphic representation of the RobTarget and RsTarget.
#region RsMoveInstructionCreateStep11
RsTarget myRsTarget_2 = new RsTarget(myWobj, cirPoint);
myRsTarget_2.Name = cirPoint.Name;
station.ActiveTask.Targets.Add(myRsTarget_2);
#endregion
// Create a circular move instruction.
#region RsMoveInstructionCreateStep12
RsMoveInstruction myMoveCirc = new RsMoveInstruction(station.ActiveTask,
"Move", "Default", myWobj.Name, cirPoint.Name, toPoint.Name, myTool.Name);
myPath.Instructions.Add(myMoveCirc);
#endregion
// Create a joint target to be able to create a MoveAbsJ move instruction.
#region RsMoveInstructionCreateStep13
RsJointTarget myJointTarget = new RsJointTarget();
myJointTarget.Name = station.ActiveTask.GetValidRapidName("myJointTarget", "_", 1);
station.ActiveTask.DataDeclarations.Add(myJointTarget);
#endregion
// Set the robot axis values.
#region RsMoveInstructionCreateStep14
RobotAxisValues rbAxis = new RobotAxisValues();
rbAxis.Rax_1 = 70.0000000000001;
rbAxis.Rax_2 = -30;
rbAxis.Rax_3 = 30;
rbAxis.Rax_4 = -55.0000000000001;
rbAxis.Rax_5 = 40;
rbAxis.Rax_6 = 10;
myJointTarget.SetRobotAxes(rbAxis, false);
#endregion
// Create a MoveAbsJ move instruction (this only makes sense if there is a mechanism in the station).
#region RsMoveInstructionCreateStep15
RsMoveInstruction myMoveAbsJ =
new RsMoveInstruction(station.ActiveTask, "MoveAbs", "Default", myJointTarget.Name);
myPath.Instructions.Add(myMoveAbsJ);
#endregion
}
catch
{
Project.UndoContext.CancelUndoStep(CancelUndoStepType.Rollback);
throw;
}
finally
{
Project.UndoContext.EndUndoStep();
}
Exceptions
Clear()
Declaration
Contains(RsInstruction)
Declaration
public bool Contains(RsInstruction item)
Parameters
Returns
CopyTo(RsInstruction[], Int32)
Declaration
public void CopyTo(RsInstruction[] array, int index)
Parameters
CopyTo(Array, Int32)
Declaration
public virtual void CopyTo(Array array, int index)
Parameters
GetEnumerator()
Declaration
public virtual IEnumerator GetEnumerator()
Returns
IndexOf(RsInstruction)
Declaration
public int IndexOf(RsInstruction item)
Parameters
Returns
Insert(Int32, RsInstruction)
Declaration
public void Insert(int index, RsInstruction item)
Parameters
Remove(RsInstruction)
Removes an instruction from a path procedure.
Declaration
public void Remove(RsInstruction instruction)
Parameters
Type |
Name |
Description |
RsInstruction |
instruction |
The instruction to be removed.
|
Examples
InstructionCollection.
Project.UndoContext.BeginUndoStep("RsMoveInstructionCreate");
try
{
#region RsMoveInstructionCreateStep1
Station station = Station.ActiveStation;
#endregion
// First import a robot (a mechanism) and add it to the station.
// NOTE: Uncomment the following lines and use them insted of the third line with the load command.
// GraphicComponentLibrary mechLib = GraphicComponentLibrary.Load(lib, true);
#region RsMoveInstructionCreateStep2
GraphicComponentLibrary mechLib = GraphicComponentLibrary.Load("IRB140_6_81_C_G_03.rslib", true);
Mechanism mechGfx = (Mechanism)mechLib.RootComponent.CopyInstance();
mechGfx.Name = "IRB140_6_81_C_G_03";
station.GraphicComponents.Add(mechGfx);
#endregion
// Set the active task to the mechanism task.
#region RsMoveInstructionCreateStep3
station.ActiveTask = mechGfx.Task;
#endregion
// Create a WorkObject and add it to the ActiveTask.
#region RsMoveInstructionCreateStep4
RsWorkObject myWobj = new RsWorkObject();
myWobj.Name = station.ActiveTask.GetValidRapidName("myWobj", "_", 1);
station.ActiveTask.DataDeclarations.Add(myWobj);
#endregion
// Create a ToolData and add it to the ActiveTask.
#region RsMoveInstructionCreateStep5
RsToolData myTool = new RsToolData();
myTool.Name = station.ActiveTask.GetValidRapidName("myTool", "_", 1);
station.ActiveTask.DataDeclarations.Add(myTool);
#endregion
// Create a new RobTarget and add it to the ActiveTask.
#region RsMoveInstructionCreateStep6
RsRobTarget toPoint = new RsRobTarget();
toPoint.Name = station.ActiveTask.GetValidRapidName("myRobTarget", "_", 1);
station.ActiveTask.DataDeclarations.Add(toPoint);
#endregion
// Create a graphic representation of the RobTarget and RsTarget.
#region RsMoveInstructionCreateStep7
RsTarget myRsTarget = new RsTarget(myWobj, toPoint);
myRsTarget.Name = toPoint.Name;
station.ActiveTask.Targets.Add(myRsTarget);
#endregion
// Create a PathProcedure.
#region RsMoveInstructionCreateStep8
RsPathProcedure myPath = new RsPathProcedure("myPath");
station.ActiveTask.PathProcedures.Add(myPath);
#endregion
// Create a linear move instruction using the move definition and the default template.
#region RsMoveInstructionCreateStep9
RsMoveInstruction myMoveL = new RsMoveInstruction
(station.ActiveTask, "Move", "Default",
MotionType.Linear, myWobj.Name, toPoint.Name, myTool.Name);
myPath.Instructions.Add(myMoveL);
#endregion
// Create a new RobTarget to use as cirPoint and add it to the ActiveTask.
#region RsMoveInstructionCreateStep10
RsRobTarget cirPoint = new RsRobTarget();
cirPoint.Name = station.ActiveTask.GetValidRapidName("myRobTarget", "_", 1);
cirPoint.Frame.X = cirPoint.Frame.X + 0.10;
cirPoint.Frame.Z = cirPoint.Frame.Z + 0.10;
station.ActiveTask.DataDeclarations.Add(cirPoint);
#endregion
// Create a graphic representation of the RobTarget and RsTarget.
#region RsMoveInstructionCreateStep11
RsTarget myRsTarget_2 = new RsTarget(myWobj, cirPoint);
myRsTarget_2.Name = cirPoint.Name;
station.ActiveTask.Targets.Add(myRsTarget_2);
#endregion
// Create a circular move instruction.
#region RsMoveInstructionCreateStep12
RsMoveInstruction myMoveCirc = new RsMoveInstruction(station.ActiveTask,
"Move", "Default", myWobj.Name, cirPoint.Name, toPoint.Name, myTool.Name);
myPath.Instructions.Add(myMoveCirc);
#endregion
// Create a joint target to be able to create a MoveAbsJ move instruction.
#region RsMoveInstructionCreateStep13
RsJointTarget myJointTarget = new RsJointTarget();
myJointTarget.Name = station.ActiveTask.GetValidRapidName("myJointTarget", "_", 1);
station.ActiveTask.DataDeclarations.Add(myJointTarget);
#endregion
// Set the robot axis values.
#region RsMoveInstructionCreateStep14
RobotAxisValues rbAxis = new RobotAxisValues();
rbAxis.Rax_1 = 70.0000000000001;
rbAxis.Rax_2 = -30;
rbAxis.Rax_3 = 30;
rbAxis.Rax_4 = -55.0000000000001;
rbAxis.Rax_5 = 40;
rbAxis.Rax_6 = 10;
myJointTarget.SetRobotAxes(rbAxis, false);
#endregion
// Create a MoveAbsJ move instruction (this only makes sense if there is a mechanism in the station).
#region RsMoveInstructionCreateStep15
RsMoveInstruction myMoveAbsJ =
new RsMoveInstruction(station.ActiveTask, "MoveAbs", "Default", myJointTarget.Name);
myPath.Instructions.Add(myMoveAbsJ);
#endregion
}
catch
{
Project.UndoContext.CancelUndoStep(CancelUndoStepType.Rollback);
throw;
}
finally
{
Project.UndoContext.EndUndoStep();
}
RemoveAt(Int32)
Declaration
public void RemoveAt(int index)
Parameters
Type |
Name |
Description |
Int32 |
index |
|
ToArray()
Declaration
public RsInstruction[] ToArray()
Returns