RsInstructionArgument Constructor |
Namespace: ABB.Robotics.RobotStudio.Stations
public RsInstructionArgument( string name, string 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(); }