The library can open and edit program files with .urp extension. You can access and modify inner XML.
URProgram prg = URProgram.Load(@"C:\myPrg.urp");XElement innerXml = prg.XML;// Set program associated installation file// You can also add instructions or change other attributesinnerXml.Attribute("installationRelativePath").Value = "default";// Save modified program files// You could then transfer this file to the robot with SFTPprg.Save(@"C:\myPrg.urp");
The library can open and edit installation files with .installation extension.
URInstallation prg = URInstallation.Load(@"C:\default.installation");XElement innerXml = prg.XML;// Change your installation settingsinnerXml.Attribute("showSpeedSliderOnRunTab").Value = "true";// Save modified program files// You could then transfer this file to the robot with SFTPprg.Save(@"C:\default.installation");
public abstract class URArchive {protected URArchive(XElement xml)protected abstract string Extension { get; }// File name that should be used on a UR robotpublic string FileName { get; }// Load a UR archive from stream and decode it as XMLpublic static XElement Load(Stream fileStream)// Load a UR archive from file path and decode it as XMLpublic static XElement Load(string filePath)public string Name { get; set; }protected abstract string NameAttribute { get; }protected abstract string RootElement { get; }// Save encoded file to a streampublic void Save(Stream stream)// Save encoded file to a directory, overwrite it if it existspublic string Save(string directory)// XML description of the objectpublic XElement XML { get; }}
public class URProgram : URArchive {// Create a URProgram from its XML definitionpublic URProgram(XElement xml)protected override string Extension { get; }public const string EXTENSION = ".urp"// Load a program from streampublic static URProgram Load(Stream urpStream)// Load a *.urp program from file pathpublic static URProgram Load(string urpFile)protected override string NameAttribute { get; }protected override string RootElement { get; }}
public class URInstallation : URArchive {// Create a URProgram from its XML definitionpublic URInstallation(XElement xml)protected override string Extension { get; }public const string EXTENSION = ".installation"// Load an installation file from streampublic static URInstallation Load(Stream urpStream)// Load a *.installation file from pathpublic static URInstallation Load(string urpFile)protected override string NameAttribute { get; }protected override string RootElement { get; }}