Getting RsInstructionTemplate
This example provides information on getting RsInstructionTemplate. An active station for this example.
Pass the InstructionTemplate name as a parameter. To check the result of the addin, ensure that the InstructionTemplate is present in the RobotStudio template manager.
Get RsInstructionTemplate by following these steps:
Get RsProcessTemplate.
Get Linear MotionType RsInstructionTemplate object using GetTemplate Instance method of RsProcessTemplate.
Solution
Get RsProcessTemplate.
RsProcessTemplate rsProcTemp = GetRsProcessTemplate(task, "Move", "Default");
Get Linear MotionType RsInstructionTemplate object using GetTemplate Instance method of RsProcessTemplate.
if (rsProcTemp != null) { //Get Template of type of Linear return rsProcTemp.GetTemplate(MotionType.Linear); } else { return null; }
Example
This example provides information on getting the RsInstructionTemplate.
private static RsInstructionTemplate GetRsInstructionTemplate(RsTask task)
{
Project.UndoContext.BeginUndoStep("GetRsInstructionTemplate");
try
{
//Get RobotStudio ProcessTemplate
RsProcessTemplate rsProcTemp = GetRsProcessTemplate(task, "Move", "Default");
if (rsProcTemp != null)
{
//Get Template of type of Linear
return rsProcTemp.GetTemplate(MotionType.Linear);
}
else
{
return null;
}
}
catch (Exception ex)
{
Logger.AddMessage(new LogMessage(ex.Message.ToString()));
Project.UndoContext.CancelUndoStep(CancelUndoStepType.Rollback);
}
finally
{
Project.UndoContext.EndUndoStep();
}
return null;
}
Required Namespaces
ABB.Robotics.RobotStudio.Environment
ABB.Robotics.Controllers.RapidDomain