Importing ProcessDefinition
This example provides information on importing ProcessDefinition. You will need an active station for this example.
You need to pass the filepath of process defintion. To check the result of the addin, ensure that the instruction can be created from RobotStudio.
Use this procedure to Import RsProcessDefintion:
Get Station object.
Create XmlTextReader object.
ImportProcessDefinitions by passing the XmlTextReader object from step2.
Solution
Get Station object.
Station station = Project.ActiveProject as Station;
Create XmlTextReader object.
textReader = new StreamReader(filePath); XmlTextReader definitionFile = new XmlTextReader(textReader);
ImportProcessDefinitions by passing the XmlTextReader object from step2.
station.ActiveTask.ImportProcessDefinitions(definitionFile); textReader.Close();
Example
This example provides information on importing RsProcessDefinition.
private static bool ImportProcessDefinitionFile(string filePath)
{
TextReader textReader = null;
//Get Station object
Station station = Project.ActiveProject as Station;
try
{
//Read the file
textReader = new StreamReader(filePath);
XmlTextReader definitionFile = new XmlTextReader(textReader);
//Import Process Definition into task
station.ActiveTask.ImportProcessDefinitions(definitionFile);
textReader.Close();
return true;
}
catch
{
if (textReader != null)
textReader.Close();
return false;
}
}
Required Namespaces
ABB.Robotics.RobotStudio.Environment
ABB.Robotics.Controllers.RapidDomain